Reply
Highlighted
Frequent Visitor
Posts: 11
Registered: ‎03-13-2017
Accepted Solution

13 Week Rolling Average Graph with Daily %

After looking at some examples previously posted, I still cant figure out how to implement this seemingly easy concept into my PowerBI report.  

 

My dataset only includes the columns: [Date], and [Success%]

 

Sample Data:

 

Date        |   Success% |
01/01/2016 | 95.12 | ............|............|
05/10/2017 | 97.49 | 05/11/2017 | 96.24 | 05/12/2017 | 95.67 | 05/13/2017 | 98.56 |
............|............|
11/24/2017 | 97.45 |

How would a rolling 13 Week Average be calculated?  It does not have to be filterable; just show the last 13 Weeks on a Line Graph Visual, like below.  I would like to show the graph below with the Daily% and 13 week Average % together.

Capture.PNGDaily %

This seems like it would be an easy problem....just not for me Smiley Happy.

 

 

Any help would be greatly appreciated.

 

 


Accepted Solutions
Super User
Posts: 4,103
Registered: ‎01-14-2017

Re: 13 Week Rolling Average Graph with Daily %

Hi,

 

Try this

 

  1. Create a calendar table which should have all dates that exist in your dataset.  There should be no repetitions in the calendar table and no date should be missed either
  2. Create a relationship from the Date column of your data table to the date column of your calendar table
  3. In your visual, drag the date field from the calendar table
  4. Write the following measures

Success rate = SUM(Data[Success%])

13 week average success rate = CALCULATE([Success rate],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-91,MIN(Calendar[Date])))

 

Hope this helps.

View solution in original post


All Replies
Super User
Posts: 10,775
Registered: ‎07-11-2015

Re: 13 Week Rolling Average Graph with Daily %

One method would be to create a new column like:

 

WeeksAgo = WEEKNUM(TODAY()) - WEEKNUM([Date])

Then you could just filter <= 12


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Frequent Visitor
Posts: 11
Registered: ‎03-13-2017

Re: 13 Week Rolling Average Graph with Daily %

Thanks for the quick reply.  I was trying to calculate the 13 week Average and then display it on the same graph visual as the daily %.  This would help narrow down the dates to only show the 13 weeks, but not the average of the last 13 weeks; unless I misunderstood your usage.      

Super User
Posts: 4,103
Registered: ‎01-14-2017

Re: 13 Week Rolling Average Graph with Daily %

Hi,

 

Try this

 

  1. Create a calendar table which should have all dates that exist in your dataset.  There should be no repetitions in the calendar table and no date should be missed either
  2. Create a relationship from the Date column of your data table to the date column of your calendar table
  3. In your visual, drag the date field from the calendar table
  4. Write the following measures

Success rate = SUM(Data[Success%])

13 week average success rate = CALCULATE([Success rate],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-91,MIN(Calendar[Date])))

 

Hope this helps.

Frequent Visitor
Posts: 11
Registered: ‎03-13-2017

Re: 13 Week Rolling Average Graph with Daily %

Thanks for the reply.  After trying your suggestion, I still could not manage to get this to work.  When I add your new 13 weeks measure to the graph it shows the exact same as the daily % (see the inlcuded screenshot.) Your idea is exactly what I was looking for, I just cant make it work.

 

Capture.PNG

Super User
Posts: 4,103
Registered: ‎01-14-2017

Re: 13 Week Rolling Average Graph with Daily %

Hi,

 

Share the link from where i can download your file.