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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mahfav
New Member

calculating the summation of differences between sales value and the sales average

Hi everyone,

I have a question regarding my powerbi dashboard. I need a measure to calculate the summation of differences between sales values (for each month - 1 to 6) and the average of sales. Accordingly, I have written a formula for calculating the sales average as the follows (it works correctly):

Avrsales = averagex(values(table[month]),table[sales])

However, for calculating the Mean average differences (MAD), this formula returns zero, which is a wrong number (it must return 84 for the sample data in the attached photoSample Figure.JPG

MAD = sumx(values(table[month]),abs(table[sales]-Avrsales))

Please see the attached, which is the sales figure for each month (first six months of the year).

I will be so grateful if you may help with your suggestions/solutions.

Thanks in advance

3 REPLIES 3
parry2k
Super User
Super User

@mahfav I think you need this but hard to tell without the data:

 

MAD = 
SUMX (
   VALUES ( Table[month] ),
   ABS ( table[sales] - CALCULATE ( [Avrsales], ALLSELECTED ( Table[Month] ) ) )
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Ashish_Mathur
Super User
Super User

Hi,

You should create a Calendar Table with a relationship (Many to One and Single) from the Date column of the table to the Date column of the Calendar Table.  In the Calendar Table, create calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number.  To your visual, drag Month name from the calendar Table.  Create a year slicer and select 2023.  Write these measures:

Total = sum(table[sales])

Average sales across all months = averagex(all(Calendar),[Total])

Diff = abs([Total]-[Average sales across all months])

MAD = SUMX(values(Calendar[Month name]),[Diff])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @mahfav 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors