Forum Discussion
jdwalker5
2 years agoHelper II
Rolling 4 Week Total
Hello, I'm trying to get a rolling 4 week total for each row in a summarized table. Example below with expected result. Week Item Total Rolling 4 Week Total 8 A 5 50 7 A 10...
- 2 years ago
amitchandak
2 years agoSuper User
jdwalker5 , Prefer to have a separate table with Week on Year week depending on the data. If this year's week creates a rank column, for only week you use week in place of week rank
Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format
Last 4 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-4 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
- jdwalker52 years agoHelper II
Thanks amitchandak , I did not have a chance to try your solution out, but it looks like it probably would have worked. I ended up pulling in a new dataset and used a SQL window function, but I appreciate you taking the time to respond!