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

How to calculate percentage of subtotals?

Dear All,

 

For a table with this layout (as mentioned below) I would like to calculate the percentage based on the subtotal. 

 

Power_BI_Adapt_1-1651757928736.png

 

In this example:

 

Subtotal of first company is 7288, with a break down to 2775 and 4514

 

Subtotal of second company is 4809, with a break down to 3431 and 1378

 

I want to come to the following percentages:

 

First company:

* Subtotal:  100%

* Eerder dan 13.00 uur: 38%

* Later dan 13.00 uur: 62%

 

Second company: 

 

* Subtotal:  100%

* Eerder dan 13.00 uur: 71%

* Later dan 13.00 uur: 29%

 

A DAX or any oher solution will be helpful, to create a separate column with a percentage.

 

Kind regards

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below, and I hope the below measure can help to modify and apply it to your data model.

 

Slide1.jpg

 

SubCat ratio: =
IF (
    ISINSCOPE ( SubCategory[Category] ),
    DIVIDE (
        Data[Total value:],
        CALCULATE ( Data[Total value:], ALLEXCEPT ( Data, SubCategory[Category] ) )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? 

If your values in the matrix are columns, you still need a SUM function:

Percentage =
DIVIDE (
    'Table'[Value],
    CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Company] ) )
)

vkalyjmsft_0-1652249538212.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? 

If your values in the matrix are columns, you still need a SUM function:

Percentage =
DIVIDE (
    'Table'[Value],
    CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Company] ) )
)

vkalyjmsft_0-1652249538212.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below, and I hope the below measure can help to modify and apply it to your data model.

 

Slide1.jpg

 

SubCat ratio: =
IF (
    ISINSCOPE ( SubCategory[Category] ),
    DIVIDE (
        Data[Total value:],
        CALCULATE ( Data[Total value:], ALLEXCEPT ( Data, SubCategory[Category] ) )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

This looks like it's exactly the solution I've been looking for, for several days. Thanks so much for providing the file. I intend to try modifying the code for my needs shortly.

Super it worked, kudos to you, thanks.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.