Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Stemar_Aubert
Resolver I
Resolver I

Matrix Visual: Allselected and subcategories.

Hello everyone,

 

Consider the following dataset:

 

REGIONCOUNTRYPRODUCT 1PRODUCT 2PRODUCT 3ITEMSDATE
ASIACHINASEDANA3GPS101.01.2000
EUROPEPORTUGALCOUPEA7AUTODRIVE101.01.2000
AMERICAMEXICOSEDANA3NONE101.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 2PRODUCT 3RATIO
A3-100%
-GPS50%
-NONE50%

 

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 2PRODUCT 3RATIO
A3-50%
-GPS25%
-NONE25%
A7-50%
-AUTODRIVE50%

 

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%.

 

2021-07-19 17-39-00_Start.png

 

Thanks for any help.

1 ACCEPTED 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.

 
I could then swap the ALLSELECTED with ALLEXCEPT, and I now have the desired results.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@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.

parry2k
Super User
Super User

@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.

 
I could then swap the ALLSELECTED with ALLEXCEPT, and I now have the desired results.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.