Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Runing total by row

Hi,
i have seen this asked a few times but i have been unable to use this for my task

I have a column for Wind direction and one for timestamp as well as various other columns that are filtering out the data

I want a matrix like one below but the cells to contain the running total of the rows

 

I have tried the quick measure but cant seem to get it right

 

What it looks like:

 

Wind Direction                   Jan           Feb        Total

0                                           10             9              19

10                                           5             6              11

...

 

What im after

 

Wind Direction                   Jan           Feb        Total

0                                           10            19              19

10                                           5            11              11

...



sample: https://1drv.ms/u/s!AqgwstyhNHf8gsphsHZD3rVqVPMtQg?e=PWPRZs

(sample file is dummy data, will differ from the table typed above)

4 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous 

     

    You can create a measure with below code:-

    cumulative_total=
    CALCULATE (
    SUM ( 'table'[<values column>] ),
    FILTER ( ALL ( 'table'[date] ), 'table'[date] <= MAX ( 'table'[date] ) )
    )

    Thanks,

    Samarth

      • ryan_mayu's avatar
        ryan_mayu
        Super User

        Anonymous 

        pls try this

         

        Measure = CALCULATE(sum(test[Valid Data]),FILTER(test,'test'[WD (bins)]=max('test'[WD (bins)])&&'test'[Date]<=max('test'[Date])))

         

         

        if you want the total to display the correct value , create another measure

        Measure 2 = sumx(test,[Measure])