Forum Discussion
Anonymous
7 years agoNot applicable
Cumulative Sum with filter
I am trying to do a cumulative measure to add to a chart, however becuase my data structure consist of stacked monthly reports if I do so using the below code I end up with summing over repeated inst...
- 7 years ago
Ohh now I understand! Try this! :-)
Cumulative Quantity := VAR _date = SELECTEDVALUE('Table'[Date] )
VAR _period = SELECTEDVALUE('Table'[Report Date]) Return CALCULATE ( SUM ( Transactions[Quantity] ), ALL ( 'Table' ), 'Table'[Date] <= _date,
'Table'[Report Date] = _period
)
tex628
7 years agoCommunity Champion
Relationship is between 'Table'[Date] and 'Date'[Date] and has to stay that way?
Anonymous
7 years agoNot applicable
I'm not sure I follow? I don't think the relationship matters.
Below is an example of where I hope to get to using the above data, the cumulative for the latest report (Apr-19), as a measure not column.
| Report Date | Date | Value | Cumulative |
| Apr-19 | 01/01/2019 | 500 | 500 |
| Apr-19 | 01/02/2019 | 900 | 1400 |
| Apr-19 | 01/03/2019 | 200 | 1600 |
| Apr-19 | 01/04/2019 | 200 | 1800 |
- tex6287 years agoCommunity Champion
Ohh now I understand! Try this! :-)
Cumulative Quantity := VAR _date = SELECTEDVALUE('Table'[Date] )
VAR _period = SELECTEDVALUE('Table'[Report Date]) Return CALCULATE ( SUM ( Transactions[Quantity] ), ALL ( 'Table' ), 'Table'[Date] <= _date,
'Table'[Report Date] = _period
)