Forum Discussion
Calculating YTD absolute error and YTD average abs error
Hello all,
Hoping for some assistance with this effort. I have the below matrix example, calculating the absolute error of forecast vs sales by product family by month:
I'm trying to calculate the YTD abs error and YTD average absolute error - so going from top to bottom (Cube to Sphere) for February I would expect the YTD avg abs error to be 11.02, 31.965, 42.99, and 132.28 respectively, and March would start off with 9.55 for Cube (avg of 11.02 for Jan + 11.02 for Feb + 6.61 for March), and so on.
I'd additionally like the YTD abs error value to be the sum of each month's abs error, rather than recalculating it monthly based on the sum of the FC and sales. (So, for example, March's YTD abs error for Cube would be 11.02+11.02+6.61 = 28.65, not the sum of orders from Jan-Mar (22.05+33.07+26.46) - the sum of FC from Jan-Mar (11.02+22.05+33.07) = 15.44).
I've attached a GDrive link to the example pbix for examination - please go easy on my limited DAX knowledge at this point. Help
2 Replies
- amitchandak
Super User
U382911 , For ytd you can use time intelligence using date table
YTD Sales = CALCULATE(SUM(Table[error]),DATESYTD('Date'[Date],"12/31"))
for error
YTD Sales = CALCULATE(Averagex(Values(Date[Month Year]), calculate( SUM(Table[error]))) ,DATESYTD('Date'[Date],"12/31"))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uATime Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s - U382911Frequent Visitor
Thank you. For the monthly buckets, this works perfectly. However, it doesn't appear to be totaling correctly.
Is there an easy change to the formula or another measure to correct this?
Link to updated pbix file: https://drive.google.com/file/d/10mzPDK4dzcV3nx3CIJXt90EFSTRkR73q/view?usp=drive_link