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.
Anonymous why there is no adidas in the expected output?
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
Hi parry2k
This is an example. In my real data, I need to show a category that would be "Nike" here, to show the total items sold no matter the city. The cities that appear below, if you see, they are the sum of both Nike an adidas items sold. For instance, Madrid is 400 (100+300) in the first column (Alicia).
Thank you 🙂