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
Jomachado1
New Member

DAX formula - Wrong subtotal/total in a table

Hello, 

I ve a table with the comsuptions by prodution order and then the drilldown by material.

I want to calculate the amount in euros of the difference between the real and teorical consumptions.

The delta (in units and euros are correct). But the total of the delta in euros at order level not (should be the sum of the material differences).

Jomachado1_0-1727430476451.png

 

The data have the following structure:

One table with the real consumptions by production order and material;

One table with the teorical consumptions by production order and material;

Another table with price of each material in euros;

 

 

The measure that I want to fix is:

Jomachado1_1-1727430814083.png

 Any suggestion?

1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @Jomachado1 , 

 

You can use SUMX to bring the row context in the calculation, please try the below measure..

 

Delta in euros =
SUMX('Material Table',
CALCULATE(SUM('Price Table'[Unit Price]) *
(SUM('Real Consumption Table'[Consumption]) - SUM('Theoretical Consumption Table'[Consumption]))))

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

2 REPLIES 2
dharmendars007
Super User
Super User

Hello @Jomachado1 , 

 

You can use SUMX to bring the row context in the calculation, please try the below measure..

 

Delta in euros =
SUMX('Material Table',
CALCULATE(SUM('Price Table'[Unit Price]) *
(SUM('Real Consumption Table'[Consumption]) - SUM('Theoretical Consumption Table'[Consumption]))))

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Thanks Dharmendar  for the quick response.

 

The soluction propose works perfectely!

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.