Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hello everyone,
Consider the following dataset:
REGION | COUNTRY | PRODUCT 1 | PRODUCT 2 | PRODUCT 3 | ITEMS | DATE |
ASIA | CHINA | SEDAN | A3 | GPS | 1 | 01.01.2000 |
EUROPE | PORTUGAL | COUPE | A7 | AUTODRIVE | 1 | 01.01.2000 |
AMERICA | MEXICO | SEDAN | A3 | NONE | 1 | 01.01.2000 |
I have geographical and categorical dimensions. My goal is to calculate the ratio of each PRODUCT 3 against PRODUCT 2
Yield would be like this :
PRODUCT 2 | PRODUCT 3 | RATIO |
A3 | - | 100% |
- | GPS | 50% |
- | NONE | 50% |
However, under the constrain of having slicers based on both geo and categorical dimensions, I did not find a satisfying measure.
Currently, I have this (simplified form, the original one includes time intelligence filters) :
RATIO =
DIVIDE (
CALCULATE ( SUM ( 'TABLE'[ITEMS] ) ),
CALCULATE ( SUM ( 'TABLE'[ITEMS] ), ALLSELECTED ( 'TABLE' ) )
)
While this gives me the proper results if I slice down to PRODUCT 2 level, in a matrix visual, it gives me the following output :
PRODUCT 2 | PRODUCT 3 | RATIO |
A3 | - | 50% |
- | GPS | 25% |
- | NONE | 25% |
A7 | - | 50% |
- | AUTODRIVE | 50% |
To clarify, below are actuals Results. This is a matrix visual, and first column has a hierarchy of PRODUCT 2 and PRODUCT 3.
As you can see, PRODUCT 2 sums to a total of 100%, and subtotals to each respective category participation to said total.
Desired output shows each bold number at 100%. Total result doesn't have any significance and can be removed. PRODUCT 3 totals should sum to 100%.
Thanks for any help.
Solved! Go to Solution.
Hi @parry2k
Thanks for the insights. Actually, I found out there was a slicer put out behind the visual which was impacting it, hence I could never reach 100%.
Lesson learned !
To handle this, I have set to use another parameter in the Calculate statement, to eliminate what is out of scope based on the slicer.
@Stemar_Aubert glad you figured it out. cheers!!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Stemar_Aubert I think you need to change your measure to:
RATIO =
DIVIDE (
CALCULATE ( SUM ( 'TABLE'[ITEMS] ) ),
CALCULATE ( SUM ( 'TABLE'[ITEMS] ), ALLSELECTED ( 'TABLE'[Product3] ) )
)
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts 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.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k
Thanks for the insights. Actually, I found out there was a slicer put out behind the visual which was impacting it, hence I could never reach 100%.
Lesson learned !
To handle this, I have set to use another parameter in the Calculate statement, to eliminate what is out of scope based on the slicer.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.