Forum Discussion
Aggregate Absolute Value At a More General Level
Hi,
I have data that is at the unit > multiple drivers > label > date.
What I want to be able to do is get the absolute difference by day by filtering at the unit level. So below is a mock up of the data set current (forecast vs actual column does not exist in the data set). What I want to do is get a result of 59 by combining each day, then take the absolute difference for each day, then sum by unit when I filter a unit. I used this formula, which works when I display the date on the matrix of 0+2+11+3+33+10+0 but on any visual without the day detail, it shows 39 which isnt right.
Actual Data Set
| Unit | Date | Forecast vs Actual | Actual | Plan Adjusted | POS Label |
| 123456 | 9/26/2020 | 4 | 19 | 15 | 0010Group |
| 123456 | 9/26/2020 | 4 | 334 | 338 | 0010Trans |
| 123456 | 9/27/2020 | 1 | 2 | 1 | 0010Group |
| 123456 | 9/27/2020 | 1 | 344 | 343 | 0010Trans |
| 123456 | 9/28/2020 | 11 | 308 | 297 | 0010Trans |
| 123456 | 9/29/2020 | 3 | 295 | 292 | 0010Trans |
| 123456 | 9/30/2020 | 33 | 306 | 273 | 0010Trans |
| 123456 | 10/1/2020 | 1 | 2 | 1 | 0010Group |
| 123456 | 10/1/2020 | 11 | 342 | 353 | 0010Trans |
| 123456 | 10/2/2020 | 2 | 3 | 1 | 0010Group |
| 123456 | 10/2/2020 | 2 | 352 | 354 | 0010Trans |
Desired Result, which i can get on a matrix if i show date.
| unit | Date | Forecast vs Actual | Actual | Plan Adjusted | POS Label |
| 123456 | 9/26/2020 | 0 | 353 | 353 | ignore |
| 123456 | 9/27/2020 | 2 | 346 | 344 | ignore |
| 123456 | 9/28/2020 | 11 | 308 | 297 | ignore |
| 123456 | 9/29/2020 | 3 | 295 | 292 | ignore |
| 123456 | 9/30/2020 | 33 | 306 | 273 | ignore |
| 123456 | 10/1/2020 | 10 | 344 | 354 | ignore |
| 123456 | 10/2/2020 | 0 | 355 | 355 | ignore |
But once I only do unit this happens:
| unit | Forecast vs Actual |
| 123456 | 39 |
Had this also, but this ends up with 73 which is the detailed by day abs value.
think you need a sumx to bracket the original measure.
AbsDiff:=SUMX(VALUES(Table2[Date]),CALCULATE(ABS(SUM(Table2[Actual])-SUM(Table2[Plan Adjusted]))))
1 Reply
- wdx223_Daniel
Community Champion
think you need a sumx to bracket the original measure.
AbsDiff:=SUMX(VALUES(Table2[Date]),CALCULATE(ABS(SUM(Table2[Actual])-SUM(Table2[Plan Adjusted]))))