Forum Discussion
Change hierarchy level in matrix visualization
- Anonymous4 years ago
Hi Anonymous ,
Please refer to my pbix file to see if it helps you.
Create a measure.
Measure = VAR _value = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), 'Table'[City] = SELECTEDVALUE ( 'Table'[City] ) && 'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] ) ) ) VAR _NIKE = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), 'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] ) && 'Table'[City] = SELECTEDVALUE ( 'Table'[City] ) ) ) VAR result = IF ( HASONEVALUE ( 'Table'[City] ) && MAX ( 'Table'[Company] ) = "NIKE", _NIKE, IF ( HASONEVALUE ( 'Table'[City] ) && MAX ( 'Table'[Company] ) = "Adidas", _NIKE, SELECTEDVALUE ( 'Table'[Value] ) ) ) VAR _a = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), 'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] ) && 'Table'[Company] = SELECTEDVALUE ( 'Table'[Company] ) ) ) RETURN IF ( HASONEVALUE ( 'Table'[City] ), result, _a )If I have misunderstood your meaning, please provide more details with your desired output.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Please refer to my pbix file to see if it helps you.
Create a measure.
Measure =
VAR _value =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
'Table'[City] = SELECTEDVALUE ( 'Table'[City] )
&& 'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] )
)
)
VAR _NIKE =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] )
&& 'Table'[City] = SELECTEDVALUE ( 'Table'[City] )
)
)
VAR result =
IF (
HASONEVALUE ( 'Table'[City] )
&& MAX ( 'Table'[Company] ) = "NIKE",
_NIKE,
IF (
HASONEVALUE ( 'Table'[City] )
&& MAX ( 'Table'[Company] ) = "Adidas",
_NIKE,
SELECTEDVALUE ( 'Table'[Value] )
)
)
VAR _a =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
'Table'[Label] = SELECTEDVALUE ( 'Table'[Label] )
&& 'Table'[Company] = SELECTEDVALUE ( 'Table'[Company] )
)
)
RETURN
IF ( HASONEVALUE ( 'Table'[City] ), result, _a )
If I have misunderstood your meaning, please provide more details with your desired output.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Sorry for the late response. I couldn't check the code until now.
That's exactly what I wanted!! I didn't think it could be possible, you are brilliant!
I really appreciate that you have taken the time to help me. 😊
Thank you very much! 😊