Forum Discussion
Matrix Table Drill Down
- 6 years ago
Hi WendyDUFE ,
Try this:
Measure = VAR Value_ = SWITCH ( TRUE (), ISINSCOPE ( 'Dimension'[District] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[District], 'Dimension'[District] ) ), ISINSCOPE ( 'Dimension'[City] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[City], 'Dimension'[City] ) ), ISINSCOPE ( 'Dimension'[Province] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Province], 'Dimension'[Province] ) ), ISINSCOPE ( 'Dimension'[Country] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Country], 'Dimension'[Country] ) ) ) RETURN IF ( ISBLANK ( Value_ ), "-", Value_ )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 6 years ago
Hi WendyDUFE ,
Try this:
Budget Amount = VAR Value_ = SWITCH ( TRUE (), ISINSCOPE ( 'Dimension'[District] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[District], 'Dimension'[District] ) ), ISINSCOPE ( 'Dimension'[City] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[City], 'Dimension'[City] ) ), ISINSCOPE ( 'Dimension'[Province] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Province], 'Dimension'[Province] ) ), ISINSCOPE ( 'Dimension'[Country] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Country], 'Dimension'[Country] ) ), SUM ( Budget[Amount] ) // ----------------added--------------------------// ) RETURN IF ( ISBLANK ( Value_ ), "-", Value_ )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can create your Budget Measure to include "ISINSCOPE" to exclude calculations on particular Column/Hierarchy
https://docs.microsoft.com/en-us/dax/isinscope-function-dax
https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/
https://www.sqlbi.com/articles/distinguishing-hasonevalue-from-isinscope/
Hi FarhanAhmed
I refered to this method ( https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/)to make adjustment, and finally got a matrix table as below:
In the fact table, if the data is associated with district dimension, then the city and province level matrix table will not do the summarization and display the total amount of district, do you know how to solve this ? It is supposed to have the upper level hierachy summerize the lower hierachy's amount, right ?
- Icey6 years ago
Community Support
Hi WendyDUFE ,
Try this:
Measure = VAR Value_ = SWITCH ( TRUE (), ISINSCOPE ( 'Dimension'[District] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[District], 'Dimension'[District] ) ), ISINSCOPE ( 'Dimension'[City] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[City], 'Dimension'[City] ) ), ISINSCOPE ( 'Dimension'[Province] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Province], 'Dimension'[Province] ) ), ISINSCOPE ( 'Dimension'[Country] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Country], 'Dimension'[Country] ) ) ) RETURN IF ( ISBLANK ( Value_ ), "-", Value_ )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- WendyDUFE6 years ago
Helper III
Thanks Icey
I have accepted this solution, but one small item need your help, I noticed the total row in the buttom of the table is blank, is there a way to have the total amount displayed ?
Thank you
- Icey6 years ago
Community Support
Hi WendyDUFE ,
Try this:
Budget Amount = VAR Value_ = SWITCH ( TRUE (), ISINSCOPE ( 'Dimension'[District] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[District], 'Dimension'[District] ) ), ISINSCOPE ( 'Dimension'[City] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[City], 'Dimension'[City] ) ), ISINSCOPE ( 'Dimension'[Province] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Province], 'Dimension'[Province] ) ), ISINSCOPE ( 'Dimension'[Country] ), CALCULATE ( SUM ( Budget[Amount] ), USERELATIONSHIP ( Budget[Country], 'Dimension'[Country] ) ), SUM ( Budget[Amount] ) // ----------------added--------------------------// ) RETURN IF ( ISBLANK ( Value_ ), "-", Value_ )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.