Solved

# Calculating a Rolling Average of Percent Adherence

• 2 replies
• 741 views

For our customers we provide daily recommendations that can either be followed or not.  We provide these recommendations for several pieces of equipment at a customer site.

So I have 2 events:

1. Recommendation X Created - Generated when our algorithms create a recommendation for a specific piece of equipment
2. Recommendation X Followed - Emitted when we detect that the recommendation was followed for that specific piece of equipment

For example, for a given day there could be 20 Recommendation X Created events and 7 Recommendation X Followed events emitted.  For simplicity assume the recommendation is a simple “Turn piece of equipment on at 8am”.  In this example we will generate a different recommendation for each piece of equipment.  So there are 20 Recommendation X Created events (each with different times.. like 8:05, 9:20, etc etc -- but ALL i care about is binary adherence… did you follow the recommendation or not for each piece of equipment)

The question I want to answer:  “In aggregate, over the past 90 days, what is the weekly rolling average of adherence to Recommendation X across all pieces of equipment as a percent?”.

An example answer to this question I want: "On the graph I see that adherence to Recommendation  X  as a rolling 7 day average started at about 30% at the customer site and increased to 60% by the end of the quarter".

I can easily generate a graph showing Event Totals that shows a rolling average.  By using custom formulas, for example Totals(A) / Totals (B), i can see the ratio/percentage however I can’t calculate this as a rolling average.  I don’t want to see the totals, just the percentage adherence.

I know this isn’t a typical use case, however, I’m trying to use our existing tooling to allow non-technical members of my team to be able to generate this type of graph.. so seeing if i can figure out how to get Amplitude to do this.

Thanks for the help!

### 2 replies

Userlevel 7
+10

Hey @znelson
Are you looking to calculate the rolling average of the ratio in a nested format here? If yes, then Amplitude currently doesn’t support this. You can however do a ratio of rolling averages as seen here

You can read more on that in similar posts below

From what I understand of your use case, funnel analysis using the holding constant clause could be an alternate way of analyzing this. This will be helpful if you want to know how many recommendations end up getting followed vs how many users follow any recommendation that was created.

You can create a funnel between Recommendation X Created Recommendation X Followed , then holding your recommendation id/ item name event property ( if present ) and looking the Conversion Over Time metric.

Let me know if I have interpreted your use case correctly. Hope this helps.

Hey Saish,

Greatly appreciate the response!  i was hoping to do the rolling average in a nested format, however, your suggestion gets me what I need (or close enough for my purposes)!  I considered a funnel analysis, but in this case, i’m actually not worrying about customers/users in aggregate -- i’m actually trying to do this for one specific customer/user at a time -- which is why amplitude likely isn’t the best tool for this -- but again, using the tools at hand that my non-technical folks know how to use.  But your solution gets me what i need, so thanks again!

Thanks so much for your assistance!