Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Cumulative Running Total by week

I have a Data file that goes like this..

 

 

Year.Week                 Bookings.Value

201850                          5

201850                          3

201850                          3

201850                          2

201850                          0

201851                           . . .

. . .

201852

. . .

201901

. . .

201902

. . .

 

How can I make a column that gives me a running total?

So something like:

Cummulative.Week                     Cummulative.Value

201850                                                  13

201851                                                  = 13 + (201851)

. . .                                                               . . .

  • Hi Anonymous ,

    In your scenario, you can create a measure:

    Cummulative.Value =
    CALCULATE (
        SUM ( Table1[Bookings.Value] ),
        FILTER ( ALL ( Table1 ), Table1[Year.Week] <= MIN ( Table1[Year.Week] ) )
    )

    The result will like below:

    Best Regards,

    Teige

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    There you go:

    Cumulative Bookings Value :=
    CALCULATE (
        SUM ( 'TableName'[Bookings.Value] ),
        FILTER (
            ALL ( 'TableName'[Year.Week] ),
            'TableName'[Year.Week] <= MAX ( 'TableName'[Year.Week] )
        )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      All that is doing is returning the original Bookings.Value numbers... Which makes no sense based on the formula but that is what I'm getting

  • TeigeGao's avatar
    TeigeGao
    Solution Sage

    Hi Anonymous ,

    In your scenario, you can create a measure:

    Cummulative.Value =
    CALCULATE (
        SUM ( Table1[Bookings.Value] ),
        FILTER ( ALL ( Table1 ), Table1[Year.Week] <= MIN ( Table1[Year.Week] ) )
    )

    The result will like below:

    Best Regards,

    Teige