What is the use of report level in dimensional level metric in MicroStrategy? - microstrategy

MicroStrategy allows us to create a dimensional metric. For example, I can create a revenue metric to be calculated at the category level. This level can be mentioned as part of the metric definition.
What is not clear to me is, why should we have report level along with the particular level like category? What would be the scenario where we should retain the report level vs. remove the report level while defining the metric.

If you remove the report level, calculations will always be performed at category level. SQL will be something like that
select category, sum(amount)
from table
group by category
for example there are two attributes in Report 1) Country 2) Category
Scenario 1: Amount of each category is constant among the countries, the above sql works
Scenario 2: Amount of each category is also divided among the countries, the above sql wont work and report level is required. The required sql for scenario 2 should be
select country,category, sum(amount)
from table
group by country,category

Related

Filemaker: display related records based on date

I have 3 tables,
Table 1:
Client
Table 2:
Followups
Table 3:
Referrals
It's a one to many relationship where one client can have multiple followup or referrals.
How do I display the Followups and Referrals between 2 dates?
I have a summary field which counts the total of each followup and referrals but they show me all the count rather than in between a given date
In your relationship graph make a new table occurance that restricts the related set based on a date range. Here is an example image. You can make "date one" and "date two" globals so that they are not stored, and operate across all records. Base your sum / count calcuations based on this relationship.
Otherwise you can use a sub-summary on your layout in list view, and place the Summary fields in the sub summary. The summary field will show the sum for that sub section.
Another option is to place the summary field inside a one-row portal and filter the portal to show only records within the desired range.
This requires much less resources than adding filtered relationships - but it can be slow if you have too many related records.

Crystal Reports - Get value from linked table conditionally

I'm new to Crystal and trying to figure out how to bring in a value from a table with multiple matches without creating duplicate rows.
I have a table of inventory items, and each inventory item has several matches in a costs table. For example inventory item 1234 may have a match for a labor cost, a material cost, and an overhead cost.
What I'd like to do is to have a single row for the inventory item, a column for it's labor cost, a column for it's material cost, etc.
So far the best I've been able to do is to create a formula field for the labor cost and use a conditional to show the cost if it's labor cost type id, but that just resulted in multiple rows where only one showed the cost and the rest showed zero.
What I would probably do in SQL (right or wrong) would be to create common table expressions for each type with the item id and the cost so each CTE would have only one cost value, then link those CTEs to the main query.
I know this is probably a really basic thing to do, but I couldn't seem to find any answers with Google. I'm happy to read over a resource if someone could just point me in the right direction.
Thanks in advance.
Add the Cost table several times to the report, once per each cost type.
This will create aliases that you can name based on the intended type.
Do the join on item ID but also add a record selection criterion for each alias to restrict it to only records of the desired cost type.
There are a couple of other options but the solution above is the cleanest approach.
I ended up accomplishing this by creating sub reports for each of the values that I was wanting to see, linking them on the item id, and filtering each report on the cost type. If there's a better way I'd love to know.

Tableau Filter on field which contains MAX of another field

I have a table in Tableau that contains football teams, their top goal scorers and the number of goals these players scored. I would like to filter the table to show the team which has the player who has scored the most goals.
For example, if my table has Team A and Team B, and Team B has the player which has scored the most goals out of every player (in all the teams), then I would like the filter to include only Team B (but show every player in Team B).
This is a good use case for a top filter.
Place Team on the filter shelf.
When defining the filter, choose the Top tab.
Select By field, Top 1, Number of Goals and Max
This tells Tableau to determine the maximum value for the [Number of Goals] field for each Team, and then filter to only include the Team with the top value.
(Note, this approach assumes that there is a single data row per player showing the total number of goals that player achieved. If your data is structured differently, say one data row per player per game, then you might need to revise the approach slightly, perhaps using an LOD calc too)
In SQL, this typically leads to a HAVING clause.
The only downside is if two teams tie for the top position, I believe you will only see one of them in that case.
If that case is important to you, you can get a similar effect using a table calc to rank teams by their max [Number of Goals], setting the tie breaking rule of your choice for the quick table calc, and then using that calc on the filter shelf to only show teams with the top rank. This will show multiple teams if they are tied for top rank.
The table calc approach is more flexible but can be less efficient, especially for large data sets, since the data is fetched from the data source to Tableau for the ranking calculation, and then only some of it is displayed. (Table calc come very late in the processing pipeline) The top filter approach performs the calculations and filters at the data source, and only sends the filtered results back to the Tableau client.

Grouping formula to account for two fields

Working with vehicle asset management and I am selecting data based on two statements:
({EQ_MAIN.PROCST_PROC_STATUS} in ["A", "AS", "AT"] and
{EQ_MAIN.DEPT_DEPT_CODE} like "P*" and
{EQ_MAIN.ASSET_TYPE} <> "COMPONENT")
or
({EQ_MAIN.PROCST_PROC_STATUS} in ["TA"] and
{EQ_MAIN.DEPT_TEMP_LOANED_TO} like "P*" and
{EQ_MAIN.ASSET_TYPE} <> "COMPONENT")
Basically, if the Equipment is in status A, AS, or AT and belongs to the departments that start with P, I want it to show on the report. However, the second part of the selection statement accounts for equipment that is temporarily loaned to another department (status TA). The selection statements seem to be working fine.
I have this data grouped by {EQ_MAIN.DEPT_DEPT_CODE}. But I want it to to include any temporarily loaned out equipment under the department group, if the equipment is on temp loan to said department. For example, Car A belongs to department K1234, but is on loan to department P5678. I want Car A to show up under the group for P5678 along with all the other vehicles that belong to P5678. Essentially, whether a piece of eq belongs to a specific department or is simply on loan to said specific department, I want to see them under the same group in Crystal. Thoughts?
I do not believe that a grouping formula is the solution for this scenario. The challenge is based in the recordset. Since there is only one LOANED_TO record per DEPT_CODE, you can go about this a couple of ways.
If this is an option, modify your query or view so that you generate all LOANED_TO records for each DEPT_CODE. This could be achieved by placing a subquery in your FROM clause if using SQL. Then, join your parent table EQ_MAIN to the subquery on a non-unique, general key. Since there is no one-to-one relationship in this scenario, you should get all LOANED_TO records for each DEPT_CODE. This will, however, bloat your recordset and mar performance.
Then, group the report first on {DEPT_CODE} and second on {LOANED_TO}. Use a suppression formula on the second group to hide any {LOANED_TO} Departments that do not match the parent group {DEPT_CODE}.
The more "traditional" Crystal approach is to group on {DEPT_CODE}. Then, add a sub report to a group section. Using the same datasource, move the second chunk of selection criteria (following the OR clause) to the sub report record selection. This will return all {LOANED_TO} records. Add a sub report link between the group {DEPT_CODE} and the sub report {LOANED_TO} dept. This will filter results to just those {LOANED_TO} records related to the main group.

SSRS divide sum by a field

I'm trying to build a report which basically reports the number of closed incidents that a property has done in a given month then divide it by the number of beds in that property.
The number of incidents is calculated from the incidents table based on the month and the property then the number of rooms is obviously static per property.
The tables that I have a:
Incident: No_ which is the ID, PropertyID, Created_DateTime, Closed_DateTime, Status.
Property: ID, Name, No_of_Rooms
I tried this code in a calculated field but it errors saying that you can't use an aggregated column, which I thought it might:
=Sum(Fields!No_.Value, "Incidents")/Fields!No_of_Rooms.Value
I'm sure this will be simple but I can't find what to search to find the answer.
If this on the 'Details' level of the report and is commonly the lowest level. You may want this instead:
=(Fields!No_.Value / Fields!No_of_Rooms.Value)
If it is on a parent group I am guessing you just are listing a single instance and it wants an aggregate. In that case:
= (Sum(fields!No_.Value) / Sum(Fields!No_of_Rooms.Value))
This would perform aggregation on an aggregation. You do not need to do this (Fields!(thing).Value, "DataSet") if everything is in the same Dataset, if not then you do. Generally if are in the table or object that your dataset is referencing it knows that part implicitly without being listed.
Your formula will work but only if placed in the tablix but for performance this should be calculated in the query if possible.