PowerBI DAX: How to calculate a running total for both date and another filter

I need to calculate a running total of a measure by date and by source. Below is a screenshot how my table looks like now.

Measure by date and by source

Below is the measure code.

CashPosition_Revenue Running Total = CALCULATE([CashPosition_Revenue],FILTER(VALUES(FilterKeys_Date[Date]), FilterKeys_Date[Date] <= MAX(FilterKeys_Date[Date])))

I need last column to be calculated as running total.

1 answer

  • answered 2019-11-08 13:47 BarneyL

    Using Values limits your filter context to the current date only, try using All to remove that filter:

    CashPosition_Revenue Running Total = 
        VAR CurrentDate = MAX(FilterKeys_Date[Date])
       RETURN 
       CALCULATE(
            SUM(FilterKeys_Date[CashPosition_Revenue]),
            FILTER(
                ALL('FilterKeys_Date'),
                FilterKeys_Date[Date] <= CurrentDate
                )
            )