Formula for percentage over time with multiple inputs

521 Views Asked by At

I'm trying to design a formula that will help me create a line graph that shows how well a user's data adheres to a goal (percentage-wise) while using more than two inputs.

I know that's confusing, so let me give my example: I'm writing a software to track personal data metrics like how often I eat healthy, (paleo diet as the example) but instead of rating each item as "does" or "does not" adhere to the diet plan, I gave the user a range of 1-4 rating for how well it adheres to their plan (1 being the best, 4 being worst)

I'm looking to make a graph that shows how well, percentage-wise, they are adhering to the plan. So if a user has 4 items logged that day with a rating of 1, they get 100%. If they have 4 items that day with a rating of 4, they get a 0%. If they have 3 items rated a 1 and 1 item rated a 4 for that day, they get 75% (you get the idea).

My problem where I'm stuck on is how to handle the 2's and 3's. I'm assuming I'll have to assign a constant to give each of these a "weight" for how much it affects the percentage, but I'm not sure how to go about it. (Suggestions for what the constant should be are also welcome!) I'd like to create 2 graphs, one showing the percentage for that day, and one showing the percentage over time including all past data points (almost like a moving average).

Thank you for your time and help, and please let me know if there's any clarifications I need to make! (apologizes for my ignorance)

1

There are 1 best solutions below

0
On BEST ANSWER

A simple thing is to assign $0$ to $3$ points to each activity, one less than the rating. Then for each day, the percentage comes from (points achieved)/(points available). If somebody rates three activities $1,3,3,4$, you would do $\frac {0+2+2+3}{4\cdot 3}=\frac 7{12} \approx 58\%$