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
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
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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.