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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to automatically change the denominator when go from category to sub-category

Could anyone kindly help me on this:

 

If I have a data set for example:

CategorySub-categorySales
FruitApple23
FruitWatermelon12
VegetablesCarrot25
VegetablesTomato35
DrinkOrange juice21
DrinkApple juice12
DrinkMelon juice16

 

I plan to add one graph to show percentages, firstly the percentage of sales of each category vs total sales, then if I click to go in to details (the 2-arrow icon on the graph), I can have the percentage of sales of each sub-category vs the total sales of that category, rather than vs the total sales of all category.

 

Is this possible? Thank you so much!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

percent =
IF (
    ISINSCOPE ( 'Table'[Category] ),
    SUM ( 'Table'[Sales] ) / CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) ),
    IF (
        ISINSCOPE ( 'Table'[Sub-category] ),
        SUM ( 'Table'[Sales] )
            / CALCULATE (
                SUM ( 'Table'[Sales] ),
                FILTER ( ALL ( 'Table' ), 'Table'[Category] = MAX ( 'Table'[Category] ) )
            ),
        SUM ( 'Table'[Sales] ) / SUM ( 'Table'[Sales] )
    )
)

Capture23.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

percent =
IF (
    ISINSCOPE ( 'Table'[Category] ),
    SUM ( 'Table'[Sales] ) / CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) ),
    IF (
        ISINSCOPE ( 'Table'[Sub-category] ),
        SUM ( 'Table'[Sales] )
            / CALCULATE (
                SUM ( 'Table'[Sales] ),
                FILTER ( ALL ( 'Table' ), 'Table'[Category] = MAX ( 'Table'[Category] ) )
            ),
        SUM ( 'Table'[Sales] ) / SUM ( 'Table'[Sales] )
    )
)

Capture23.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you so much!!! This is exactly what I want to achieve!

Greg_Deckler
Community Champion
Community Champion

So like the attached? Table 3, Page 3. I just used Show As Percent of Grand Total. You need to use the single drill down arrow to get percentage of the subcategory for the category.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.