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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
orderstatus_shi
Regular Visitor

Problem with total sums and data model.

Hello,

 

I have the following example data:

 

ModelSubmodelSold unitsdemand forecastABS(sold units-demand)
xx1321
xx2473
xx315411
xx4642

 

Data model is simple: Two different facts table, one for Orders and one for Sold units. Related to them, a Dimension table called "Master" with SKUs as Keys.

 

I would like now to sum the different abs values (0+1+1+2) in model granularity, but instead, when applying to a Matrix, it calculates the abs as the following:

(3+4+15+6) - (2+7+4+4) = 28-17 =11

While I would like it to sum it like: (1+3+11+2) = 17

So the table would be:

ModelSold unitsDemand Forecastsum of Abs
x281717

 

I have been trying everything and searching around. What is the proper way of doing this, and understanding it?

Could someone provide me with a correct formula?

 

Thanks in advance

1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

hi @orderstatus_shi You need two measures

abs = 
 VAR _abs = SUM('example data'[Sold units]) - SUM('example data'[demand forecast])
 return
 ABS(_abs)


measure_total = SUMX( VALUES('example data'[Submodel]),[abs]) 

Screenshot_37.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

2 REPLIES 2
DimaMD
Solution Sage
Solution Sage

hi @orderstatus_shi You need two measures

abs = 
 VAR _abs = SUM('example data'[Sold units]) - SUM('example data'[demand forecast])
 return
 ABS(_abs)


measure_total = SUMX( VALUES('example data'[Submodel]),[abs]) 

Screenshot_37.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
tamerj1
Super User
Super User

Hi @orderstatus_shi 
Please try

=
SUMX (
    SUMMARIZE ( Master, Master[Model], Master[Submodel] ),
    CALCULATE ( ABS ( SUM ( Orders[units] ) - SUM ( Forecast[Demand] ) ) )
)

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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