Forum Discussion
smpa01
3 years agoCommunity Champion
Running total Issue
I am trying to create a running total using WINDOW function and I am not sure if I am overcomplicating but this is the only I can get it to work.
//my base data is this
| Year | Val |
|------|---...
- 3 years ago
Here is a simpler solution
Table2 = ADDCOLUMNS(tbl, "rnt", CALCULATE(SUM('tbl'[Val]), WINDOW(1, ABS, 0, REL, ALL(tbl[Year])), ALL(tbl)))The key is to use ALL(tbl) to remove the filter on the [Val] column that's converted from row context to filter context by CALCULATE.
jeffrey_wang
3 years agoPower BI Team
Here is a simpler solution
Table2 = ADDCOLUMNS(tbl, "rnt", CALCULATE(SUM('tbl'[Val]), WINDOW(1, ABS, 0, REL, ALL(tbl[Year])), ALL(tbl)))
The key is to use ALL(tbl) to remove the filter on the [Val] column that's converted from row context to filter context by CALCULATE.