Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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 photo
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
@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.
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.
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
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 71 | |
| 50 | |
| 47 | |
| 44 |