Power BI Dax question:
I have the following table:
How can i have a running calculation using a measure which sums the 5 previous rows from "Status" column? See the photo below for the idea in excel
Any help would be greatly appreciated!
Power BI Dax question:
I have the following table:
How can i have a running calculation using a measure which sums the 5 previous rows from "Status" column? See the photo below for the idea in excel
Any help would be greatly appreciated!
You can add an extra column and do a top5 filter.
SumStatusLast5 =
VAR curDate = yourTable['TIME']
VAR allRowsBefore = FILTER(yourTable, curDate >= yourTable['TIME'])
RETURN CALCULATE(SUM[Status], TOPN(5, allRowsBefore, yourTable['TIME']))
In the first step I get the curDate of the row In the second step I get all rows where the date is equal or smaller In the last step, I take the top5 of those returned rows and sum them together