Forum Discussion
Cumulative Running Total
Hi All,
I have included a sample of my dataset below, I'm struggling to get the code for the third column to work and any help would be much appreciated.
| ID | Total Occurences | Cumulative Occurences |
| 1 | 4 | 1 |
| 1 | 4 | 2 |
| 2 | 3 | 1 |
| 1 | 4 | 3 |
| 1 | 4 | 4 |
| 2 | 3 | 2 |
| 2 | 3 | 3 |
| 3 | 1 | 1 |
| 4 | 1 | 1 |
DaxBoi - You will need something like an Index column to define "previous". Then it should be super easy. Just
COUNTROWS(FILTER('Table',[ID]=EARLIER([ID]) && [Index]<=EARLIER([Index])))DaxBoi , you need to add an index column and then you can create Cumulative
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Create a new column
countx(filter('Table',[ID]=earlier([ID]) && [Index]<=earlier([Index])),[ID] )
3 Replies
- Greg_DecklerCommunity Champion
DaxBoi - You will need something like an Index column to define "previous". Then it should be super easy. Just
COUNTROWS(FILTER('Table',[ID]=EARLIER([ID]) && [Index]<=EARLIER([Index]))) - amitchandakSuper User
DaxBoi , you need to add an index column and then you can create Cumulative
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Create a new column
countx(filter('Table',[ID]=earlier([ID]) && [Index]<=earlier([Index])),[ID] )
- fhillResident Rockstar
P.S.
Not exaclty sure the purpose of 'ID' in your table, but you can perform a 'Running Total' in this mannor as well without an Index column, BUT you have to SORT your ID low to high.