Forum Discussion

smpa01's avatar
smpa01
Community Champion
3 years ago
Solved

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 | |------|---...
  • jeffrey_wang's avatar
    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.