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

Calculate absolute variance within one column

Hi everybody,

 

I have a problem I've been trying to solve for some weeks now, but I can't come up with a solution and on Google and this forum I didn't find anything either.

 

I want to calculate the absolut variance between the sales and the forecast of a month. I have the sales data on a customer order level, so in my table it's not yet summed up to the monthly total. The forecast is on the monthly level. To make it even more complicated, the sales and the forecast volumes are not in different columns, but in one (Volume in LT, BT, EUR). There is an additional column named DataType where I declare what kind of volume (Sales, Forecast, Budget etc.) it is. 

 

Product IDDate IDCustomer IDVolume in LTVolume in BTVolume in EURDataType
70556600

31.03.2020

Customer x200140280Forecast N-1
7055660031.03.2020Customer x150105210Forecast N-3
7055660001.03.2020Customer x10714Sales
7055660004.03.2020Customer x1510,521Sales
7055660015.03.2020Customer x128,416,8Sales
7055660018.03.2020Customer x85,611,2Sales
7055660023.03.2020Customer x74,99,8Sales

 

I want to create a measue that calculates the sum of the absolut differences between the forecast and the total sales for one month on different granularity levels. Product-level would be the abs diff for every product in one month. Product-customer level would be the abs dif of every customer-product combination for one month, etc.

 

How would I do that in DAX? I hope I made clear, what I'm trying to do.

 

Your help would be massively appreciated!

 

Edit: To make it (hopefully) a bit clearer: I want something like (pseudo-code): 

 

sum( abs( Volume in LT (where DataType = Sales) - Volume in LT (where DataType = Forecast N-1))) It should calculate the abs-expression for every month-product combination and then sum all abs-results up. 

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

So, do you want to break the monthly forecast evenly across the month or do you want to sum up the sales for the month and compare to the forecast?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks for the quick reply, Greg!

 

I want to sum up the sales to a monthly total and then compare to the forecast.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.