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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Squairyy
Regular Visitor

Seperate measure for a subtotal

Hi, 

I am dealing with a simple issue but I cannot find a solution for that specific scenario.
I have a matrix table that is showing a % of results for Morning and late shift. Calculation is just [productivity]/[target].
However my subtotal column is making an average out of 2 results, while I need subtotal to be the same calculation just for the total of late and morning.

Squairyy_0-1711122271766.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @QuentinBl ,thanks for the quick reply, I'll add more.

Hi @Squairyy ,

Regarding your question, it could be that the calculated column is causing this. You can try using measures.
The Table data is shown below:

vzhouwenmsft_0-1711446450949.png

Please follow these steps:
1. Use the following DAX expression to create a measure

Measure = 
VAR _a = DIVIDE(SUM('Table'[Target]),SUM('Table'[Actual]))
VAR _b = CALCULATE(SUM('Table'[Target]),ALL('Table'[Type]))
VAR _c = CALCULATE(SUM('Table'[Actual]),ALL('Table'[Type]))
RETURN IF(
    SELECTEDVALUE('Table'[Actual]),_a,DIVIDE(_b,_c))

2. Use the following DAX expression to create a column

subtotal = DIVIDE([Target],[Actual])   

3. Final output

vzhouwenmsft_1-1711446523512.png

vzhouwenmsft_2-1711446531104.png

Best Regards,
Wenbin Zhou
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
Anonymous
Not applicable

Hi @QuentinBl ,thanks for the quick reply, I'll add more.

Hi @Squairyy ,

Regarding your question, it could be that the calculated column is causing this. You can try using measures.
The Table data is shown below:

vzhouwenmsft_0-1711446450949.png

Please follow these steps:
1. Use the following DAX expression to create a measure

Measure = 
VAR _a = DIVIDE(SUM('Table'[Target]),SUM('Table'[Actual]))
VAR _b = CALCULATE(SUM('Table'[Target]),ALL('Table'[Type]))
VAR _c = CALCULATE(SUM('Table'[Actual]),ALL('Table'[Type]))
RETURN IF(
    SELECTEDVALUE('Table'[Actual]),_a,DIVIDE(_b,_c))

2. Use the following DAX expression to create a column

subtotal = DIVIDE([Target],[Actual])   

3. Final output

vzhouwenmsft_1-1711446523512.png

vzhouwenmsft_2-1711446531104.png

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

 

Squairyy
Regular Visitor

Hi, 

Yes I did, for example:

Squairyy_1-1711377425047.png

So the proper value is 91,51%. What PowerBi shows:

Squairyy_2-1711377453505.png

90,2% which is an average of both values.

QuentinBl
Helper I
Helper I

Hello,
Did you check that the result is wrong? manually ? i think that your subtotal will always be true this way

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.