Forum Discussion

rbartk01's avatar
rbartk01
Frequent Visitor
6 years ago
Solved

Cumulative sum with Date Hierarchy

Hi,   I try to create a measure for cumulative sum using below DAX formula: Cumulative sum = CALCULATE( SUM('Sanitized CopyData'[Net Benefits]); FILTER( ALLSELECTED('Sanitized CopyData'[Date]...
  • AnthonyTilley's avatar
    6 years ago

    Hi rbartk01 

     

    you have to look at this as when using date on its own there is only one level to your matrix so the all selected gets all dates selected in that header in this case all your dates are included in the calculation 

     

    when using the hierachy you have 4 levels Year, Quater, Month and day so when drilled down to the day level the row is showing only days selected in that level whish in this case is the one day.

     

    to correct this remove the [DATE] part of your all selected function 

    Cumulative sum = 
    CALCULATE(
    	SUM('Sanitized CopyData'[Net Benefits]),
    	FILTER(
    		ALLSELECTED('Sanitized CopyData'),
    		'Sanitized CopyData'[Date] <= MAX('Sanitized CopyData'[Date])
        )
    )