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
Anonymous
Not applicable

Percent of subtotal

Current.JPGwanted.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Current: (Picture 1) %CT of Total units shows % of the entire column(3000)

 

Wanted: (Picture 2) %of CT to show % of the Subtotal (1000) 

 

 

 

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

Hi jhakak_ rawat,

 

You can use the HAVEONEVALUE function to determine whether you are currently evaluating a subclass or a parent class:

 

%CT =

IF (

    HASONEVALUE ( 'Table 1'[product] ),

    CALCULATE ( SUM ( 'Table 1'[total units] ) )

        / CALCULATE (

            SUM ( 'Table 1'[total units] ),

            ALLEXCEPT ( 'Table 1', 'Table 1'[category], 'Table 1'[date] )

        ),

    CALCULATE (

        SUM ( 'Table 1'[total units] )

            / CALCULATE (

                SUM ( 'Table 1'[total units] ),

                ALLEXCEPT ( 'Table 1', 'Table 1'[date] )

            )

    )

)

Untitled picture1.png

 

For more details, please refer to pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EUIuRUSs1axOiRw8Hk...

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

5 REPLIES 5
v-deddai1-msft
Community Support
Community Support

Hi jhakak_ rawat,

 

You can use the HAVEONEVALUE function to determine whether you are currently evaluating a subclass or a parent class:

 

%CT =

IF (

    HASONEVALUE ( 'Table 1'[product] ),

    CALCULATE ( SUM ( 'Table 1'[total units] ) )

        / CALCULATE (

            SUM ( 'Table 1'[total units] ),

            ALLEXCEPT ( 'Table 1', 'Table 1'[category], 'Table 1'[date] )

        ),

    CALCULATE (

        SUM ( 'Table 1'[total units] )

            / CALCULATE (

                SUM ( 'Table 1'[total units] ),

                ALLEXCEPT ( 'Table 1', 'Table 1'[date] )

            )

    )

)

Untitled picture1.png

 

For more details, please refer to pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EUIuRUSs1axOiRw8Hk...

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Very hepful!!! 👏👏👏

Thanks. very helpful.

amitchandak
Super User
Super User

@Anonymous 

Refer to this :https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

 

Appreciate your Kudos.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



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