Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 to see this over time, I do not want it for a single day, I want to create a table exactly like I am showing below, thanks!
Date | Sales | Running 7 Day Total |
1/1/2020 | 72 | |
1/2/2020 | 5 | |
1/3/2020 | 34 | |
1/4/2020 | 45 | |
1/5/2020 | 81 | |
1/6/2020 | 60 | |
1/7/2020 | 63 | 360 |
1/8/2020 | 6 | 294 |
1/9/2020 | 53 | 342 |
1/10/2020 | 30 | 338 |
1/11/2020 | 32 | 325 |
1/12/2020 | 35 | 279 |
1/13/2020 | 82 | 301 |
1/14/2020 | 55 | 293 |
1/15/2020 | 99 | 386 |
1/16/2020 | 97 | 430 |
1/17/2020 | 100 | 500 |
1/18/2020 | 54 | 522 |
Solved! Go to Solution.
Hi,
Assuming there is a sale recorded for everyday, try this:
Total sales = SUM(Data[Sales])
7 days rolling sales = CALCULATE([Totalsales],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-6,MIN(Calendar[Date])))
Hope this helps.
Hi,
Assuming there is a sale recorded for everyday, try this:
Total sales = SUM(Data[Sales])
7 days rolling sales = CALCULATE([Totalsales],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-6,MIN(Calendar[Date])))
Hope this helps.
@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 : )!
You are welcome.
In case you use date calendar
Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-7,MONTH))
Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Date[Date]),-7,MONTH))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
I can't think of a time intelligence measure for that. See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |