Forum Discussion
Using Hierarchy Date - Totalling issue
- 1 year ago
I could not get your measure to work as you had pasted it, but depending on how you are trying to see it aggregated by your date hierarchy, you may need to use SUMX, MINX, MAXX, or AVERAGEX. These will perform the calculation at the daily level then sum, min, max, or average the daily calculation to other date periods.
Here is a measure I got working that will rollup the daily number as a sum for month, quarter, year, etc.
Incoming = // The measure adds the volumes for "Open" and "Closed" processes and subtracts the volume for "Open" processes from the previous day. // SUMX dim_calendar will do the daily calculation then sum it by other periods (month, quarter, year). // You can also use MINX (lowest incoming that period), MAXX (highest incoming that period), or AVERAGEX (average incoming that period) SUMX( dim_calender, CALCULATE( SUM('Table'[Volume]), 'Table'[Process] = "Open" ) + CALCULATE( SUM('Table'[Volume]), 'Table'[Process] = "Closed" ) - CALCULATE( SUM('Table'[Volume]), 'Table'[Process] = "Open", PREVIOUSDAY(dim_calender[Date]) ) )More information about SUMX: SUMX function (DAX) - DAX | Microsoft Learn
I could not get your measure to work as you had pasted it, but depending on how you are trying to see it aggregated by your date hierarchy, you may need to use SUMX, MINX, MAXX, or AVERAGEX. These will perform the calculation at the daily level then sum, min, max, or average the daily calculation to other date periods.
Here is a measure I got working that will rollup the daily number as a sum for month, quarter, year, etc.
Incoming =
// The measure adds the volumes for "Open" and "Closed" processes and subtracts the volume for "Open" processes from the previous day.
// SUMX dim_calendar will do the daily calculation then sum it by other periods (month, quarter, year).
// You can also use MINX (lowest incoming that period), MAXX (highest incoming that period), or AVERAGEX (average incoming that period)
SUMX(
dim_calender,
CALCULATE(
SUM('Table'[Volume]),
'Table'[Process] = "Open"
) +
CALCULATE(
SUM('Table'[Volume]),
'Table'[Process] = "Closed"
)
- CALCULATE(
SUM('Table'[Volume]),
'Table'[Process] = "Open",
PREVIOUSDAY(dim_calender[Date])
)
)
More information about SUMX: SUMX function (DAX) - DAX | Microsoft Learn