Forum Discussion
Matrix hierarchy sum issue
- 6 years ago
Hi ainsua77 ,
Please refer to the measure below based on your sample data:
Measure = IF ( ISINSCOPE ( 'Table'[level4] ), SUM ( 'Table'[Visitor] ), IF ( ISINSCOPE ( 'Table'[level3] ), CALCULATE ( VALUES ( 'Table'[Visitor] ), FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level3] ) ) ), IF ( ISINSCOPE ( 'Table'[level2] ), CALCULATE ( VALUES ( 'Table'[Visitor] ), FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level2] ) ) ), CALCULATE ( VALUES ( 'Table'[Visitor] ), FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level1] ) ) ) ) ) )Please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Edz52VpyP21Fvq7ZvCowuuQBIUOZ3N8A7Hurs7L2vAeqAw?e=gxcGuw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi ainsua77 ,
Please refer to the measure below based on your sample data:
Measure =
IF (
ISINSCOPE ( 'Table'[level4] ),
SUM ( 'Table'[Visitor] ),
IF (
ISINSCOPE ( 'Table'[level3] ),
CALCULATE (
VALUES ( 'Table'[Visitor] ),
FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level3] ) )
),
IF (
ISINSCOPE ( 'Table'[level2] ),
CALCULATE (
VALUES ( 'Table'[Visitor] ),
FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level2] ) )
),
CALCULATE (
VALUES ( 'Table'[Visitor] ),
FILTER ( ALL ( 'Table' ), 'Table'[Web] = MAX ( 'Table'[level1] ) )
)
)
)
)
Please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Edz52VpyP21Fvq7ZvCowuuQBIUOZ3N8A7Hurs7L2vAeqAw?e=gxcGuw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
hello I have the same issue, but in my case a child can have multiples parent:, here the output that i have :
i want something like this but i want 1 as parent have 8012 and 2 as parent have 7848 etc