A productivity chart consists of a three level date hierarchy (1) year, (2) month, (3) week as Axes. Drilling down the chart over the date hierarchy, I would like to display a different measure per drillthrough level. Such that, drillthrough level (1) date[year] displays measure A, (2) date[month] displays measure B, (3) date[week] displays measure C.
Appreciate any help on this issue a lot.
Thanks in advance!
The following appeared working for me and provides a unique measure per drillthrough level:
Measure_PAR = IF(ISFILTERED(Query1[Date].[Year]) && ISFILTERED(Query1[Date].[Month])
&& ISFILTERED(Query1[Date].[Week]), Measure C
,IF(ISFILTERED(Query1[Date].[Year]) && ISFILTERED(Query1[Date].[Month]), Measure B
,IF(ISFILTERED(Query1[PRODUCTIONDATE].[Year]), Measure A)))
This is not possible in the traditional drill-down options using hierarchy. You will just be able to drill-down into the next level of hierarchy for the same measures. But, you can do a version of your desired output using Cross-report drill-through. You will have to create 3 report pages in this case, one for each level and then you can use the drill-through to report option to get the desired result:
https://learn.microsoft.com/en-us/power-bi/desktop-cross-report-drill-through
This may not be the exact solution you are looking for, but I believe this is the best possible solution for your request. Hope this helps.
Related
I have a cube in SSAS multidimensional mode.
I have created a calculating measure in visual studio called "Total Cost". The formula is:
[Measures].[Unit Cost]*[Measures].[Qty]
It is in the lowest level of granularity (i.e. - the transnational level information has these fields).
The formula works well, as long as I present the data in this same level of granularity (for example, when I create a pivot and the rows are transaction IDs - like the source file)
However, when I present it in an aggregate format (for example - by customer) - then instead of making the calculation and then sum it up, it sum up and then calculate.
Here is what I expected:
Expected results vs. What I get
My understanding, that this is regardless a (correct/incorrect) hierarchy structure. In other words, I expected this calculation to work even without defining any hierarchy between the transaction ID level and the customer level.
I'd appreciate your help!
In your SSAS project ->datasource view, you need to add a named calculation. This would be "[Unit Cost]*[Qty]". Now add this named calculation as a Measure in your Cube. This do the job. This problem was already addressed in the following link.
https://stackoverflow.com/questions/53554284/how-to-multiply-two-measures-prior-to-aggregation/53558733#53558733
I found this little code where it dynamically calculates TOTALs for all Dimension/Hierarchy I want.
This is close to what I need but will not work for Dimensions that have different number of Hierarchy Levels (Attribute Hierarchy). Current Code only works if there is only one Attribute Hierarchy because of CurrentMember.Parent. I could use CurrentMember.Parent.Parent for Dimension.Hierarchy that have two levels and so on but would not work for the the ones with only one Attribute Hierarchy (Level).
CALCULATE;
CREATE MEMBER CURRENTCUBE.[Measures].[Total On Hand Amount]
AS ([Measures].[On Hand Amount],Axis(1).Item(0).Item(0).Dimension.CurrentMember.Parent),
FORMAT_STRING = "#,#",
VISIBLE = 1 ;
I would like to make this MDX code work for any Dimension.Hierarchy regardless of number of Attribute Hierarchy (Level/s).
Any help is appreciated!!
You can use the ancestors function instead of parent. It takes a dimension parameter and a second parameter which shows how many levels you want to get (how deep in the tree to go). So if you know how many levels your dimension has you can use something like:
Ancestors(Axis(1).Item(0).Item(0).Dimension.CurrentMember, 5)
Instead of a number you can also add a dimension level as a second parameter. Then it will go as deep as the dimension level specified - so if you add the root dimension level it should get to there
(Axis(1).Item(0).Item(0).Dimension.Levels(0).Item(0), [Measures].[On Hand Amount])
Above gave me the correct answer, total for a measure for dynamic selection of any dimension but this MDX calculation would not work from PowerBI(DAX) report, which is merely PowerBI's limitation.
I got the TOTAL working now with this -
SCOPE(DESCENDANTS([Warehouses].[Warehouses],,AFTER));
[Measures].[Total On Hand Amount] = (ROOT([Warehouses]),[Measures].[On Hand Amount]);
END SCOPE;
I just have to repeat this SCOPE for each [Dimension].[Hierarchy] in the cube to make the TOTAL work for any selection including multiple dimensions from Power BI. It does not have dynamic functionality like Axis() did, but it yields the result I needed.
Hope this would help someone else too!!
How to hide measure or a scope if user choose certain dimension or go to certain dimension hierarchy level?
Thanks.
Try something like this in your MDX script:
FREEZE([Measures].[My Measure], [Product].[Subcategory].[All]);
([Measures].[My Measure], [Product].[Product].Members, [Product].[Subcategory].[Subcategory].Members) = null;
Freeze ensures the next statement won't null out the category level totals. The next statement bulls out that measure for the whole product dimension up to the subcategory totals but not above.
Note this is fine for nulling out meaningless numbers but isn't a security feature. A savvy user could do a drillthrough command to get the product level numbers. Or a savvy user could connect in a special way and clear the whole MDX script for his session so he sees the detailed product data.
For a more secure approach:
If you can null out product data for all measures then setup role based security. In dimension data security only grant access to member Subcategory.All only but uncheck visual totals on the advanced tab so that the subcategory grand total is the real total.
Or setup a second slimmed down Product dimension that only has the top levels not the detailed product levels. Then only tie that dimension to this measure group.
Or create a second measure group that does a group by in SQL and joins to the Product dimension only at the Category level. Thus there is no detailed data only rollups. Then with security control whether a used sees the detailed measures or the summary measures.
On measure properties you can set set visible property to false for the measure you want to hide. Another option is to use perspective and choose again what you want to hide or not.
I created a bar chart with 3 dimensions:
Year
Quarter
Senario
And I have one expression (Sum(Sales)).
Year, Quarter, and Scenario are displayed on the X axis.
The problem is Scenario bars is displayed in Stacked and not in Grouped style. In the Properties->Stlye->Subtype window, the Grouped and Stacked options are grayed out - the system does not allow me to choose either one of them.
How can I display Scenarios in Grouped stlye?
The problem seems to be QV cannot handle more than 2 dimensions without stacking.
I would suggest to either create a new dimension variable (for example Year & Quarter) so that you only have 2 dimension variables (Year&Quarter and Region):
Or to create a drill down group on Year -> Quarter.
In the end, I guess that it will be a matter of taste.
If you have 3 dimensions QlikView doesn't know which one to stack so removes the option.
So to solve this it groups the second dimension and stacks the 3rd
Example:
So if you switch the dimensions around I imagine you can get what you want. Unless you want Scenarios to stack and Quarters to stack, that is not possible , but I donn't know that the resultant graph would make sense.
I am very new to Tableau (first day user) and have been a long time Excel user. I am trying to fully understand the power of Tableau to eventually move away from Excel.
I have a question concerning dimensions and creating a calculated field.
My table has multiple categories and sub-categories. My goal is to display the total revenue and average order value per chosen sub-category (this seems easy enough).
I want to then take those sub-categories and show a combined sum of revenue and average of the average order value. I am stuck on trying to also combine these sub-categories to show a blended view.
Furthermore, the 2 sub-categories are weighted very differently. The average order value of 1 has a much heavier weight than the other and will definitely affect the AOV when combined. How do you also assign a weight to this combined total?
Any help will be much appreciated. I know this may be a rather simple solution but I am new to the program and am having difficulty finding this answer.
Tableau screen:
or
img1 http://postimg.org/image/dq5wqgnyl/
Best,
CR
Put sub categories in the rows column.
Put sum revenue in the text pill in the marks section
In the analysis tab on the top select column grand totals.
I'm unable to see your images,i hope this answers a apart of your question.