Forum Discussion

rack201's avatar
rack201
Frequent Visitor
5 years ago
Solved

Cumulative total based on non unique dates AND text filter

Hi - my table has non-unique dates and I'm trying to calculate a running total for a given date AND text filter pair.  My data looks the equivalent of something like the  below and what I'm aiming fo...
  • VahidDM's avatar
    5 years ago

    Hi rack201 

     

    Try this code to add a column to your table:

    Cumulative Revenue =
    VAR _Date =
        FIRSTNONBLANK ( 'Table'[WeekEndingDate], "" )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Revenue] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Store] ),
                'Table'[WeekEndingDate] <= _Date
            )
        )

     

    Output :

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos ✌️!!