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

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

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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