Forum Discussion
13 Week Rolling Average Graph with Daily %
I know this has been somewhat asked but what I'm trying to do has a slightly different presentaion and I'm having a hard time figuring out how to create a rolling average.
Below is a sample of how my data is presented.
DATE THING VALUE
| 1/1/2018 | A | 1 |
| 1/1/2018 | B | 7 |
| 1/1/2018 | C | 3 |
| 1/2/2018 | A | 4 |
| 1/2/2018 | B | 4 |
| 1/2/2018 | C | 2 |
| 1/3/2018 | A | 1 |
| 1/3/2018 | B | 8 |
| 1/3/2018 | C | 2 |
| 1/4/2018 | A | 3 |
| 1/4/2018 | B | 10 |
| 1/4/2018 | C | 10 |
| 1/5/2018 | A | 2 |
| 1/5/2018 | B | 3 |
| 1/5/2018 | C | 7 |
What I'm trying to do is, have another column to the right of VALUE that shows the average VALUE for each thing over the last number of days (15 or 30 for example).
Thanks in advance for the help
10 Replies
- aortunoFrequent Visitor
Just noticed the table was formatted slightly off. Here you can see more clearly.
- Greg_DecklerCommunity Champion
Have you looked at my rolling weeks Quick Measure?
https://community.powerbi.com/t5/Quick-Measures-Gallery/Rolling-Weeks/m-p/391694
- aortunoFrequent Visitor
No I hadn't seen it. I'm not well versed in DAX and don't know how to extract knowledge from there.
The two key differences that I see comparing it with my data are:- I have VALUES that I'd like to average
- I have different THINGS for which I want to find the average separately.
Nevertheless thank you for your response.
- Ashish_MathurSuper User
Hi,
Try this
- Create a Calendar Table by writing the following formula in Modelling > New Table =CALENDAR(MIN(Data[Date]),MAX(Data[Date]))
- Create a relationship from the Date column of the Data Table to the Date column of the Calendar Table
- Drag Date from the Calendar Table in your visual
- Drag Thing from the Data Table into the visual
- Write these measure
Total = SUM(Data[Value])
Average over the past 30 days = CALCULATE([Total],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-30,MIN(Calendar[Date])))
Hope this helps.
- aortunoFrequent Visitor
Hey thanks for you answer, I tried that DAX function and adjusted slightly because it would give me an error
Average over the past 30 days = CALCULATE(Total = SUM(Data[Value]),DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-30,MIN(Calendar[Date])))
It worked but the numbers that it gave me are much lower than what the averages actually should be.
Thanks again