Forum Discussion
Anonymous
4 years agoNot applicable
Rolling Sum for 4 previous rows based on ID
Hi, I'm looking to calculate the rolling sum for the current and the last 4 rows , based on an ID column. Any help please ?
- 4 years ago
Anonymous , Column or measure
new column =
Sumx(filter((Table), Table[ID] <= earlier(Table[ID]) && Table[ID] >= earlier(Table[ID]) -4) , [sales] )
new measure =
Sumx(filter(allselected(Table), Table[ID] <= Max(Table[ID]) && Table[ID] >= max(Table[ID]) -4) , [sales] )
amitchandak
Super User
4 years agoAnonymous , Column or measure
new column =
Sumx(filter((Table), Table[ID] <= earlier(Table[ID]) && Table[ID] >= earlier(Table[ID]) -4) , [sales] )
new measure =
Sumx(filter(allselected(Table), Table[ID] <= Max(Table[ID]) && Table[ID] >= max(Table[ID]) -4) , [sales] )
- Anonymous3 years agoNot applicable
Thankyou so much for this solution, it helps to resolved my issues.