Forum Discussion
kent_iglehart
6 years agoNew Member
Help calculating a 7 day running total column
I have a table in PowerBI that has the column "Date" and "Sales". I want to create a measure and display it in a table that computes a rolling 7 day total of the "Sales" column. To be clear, I want t...
- 6 years ago
Hi,
Assuming there is a sale recorded for everyday, try this:
- Create a Calendar Table
- Build a relationship from the Date column of the Data Table to the Date column of the Calendar Table
- To your visual, drag the Date field from the Calendar Table
- Write these measures
Total sales = SUM(Data[Sales])
7 days rolling sales = CALCULATE([Totalsales],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-6,MIN(Calendar[Date])))
Hope this helps.
kent_iglehart
6 years agoNew Member
Ashish_Mathur thank you so much that worked amazing and did exactly what I wanted. I can't tell you much I appreciate your help : )!
Ashish_Mathur
Super User
6 years agoYou are welcome.