# How to calculate trimmed mean?

Hey all!

I want to set a daily challenge to my users based on their trimmed mean for a specific period of time

I’m looking for a way to trim the lowest and highest values by x% from each side, before calculating the mean, based on the past two weeks

Context:

• Each user earn daily points
• the daily challenge should should be their daily average score from the past two weeks
• the mean should be trimmed in the edges, so very low/high days won’t affect the mean

Why not using the median?
It’s an option, but there is one issue: the median takes the middle value of the series which doesn’t represent properly the right Challenge Value (because the middle value for every period of time can change drastically compared to a trimmed mean)

Hope that makes sense

Would love to hear how should I approach this

Thanks!

Ok I got you

So once you get a few values it’s easy to calculate this. Maybe you want to every day have a workflow that calculates this value for all users, maybe just per user. So here’s the basic explanation:

Determine the % you want to keep from the highest value
Determine the % you want to add to the lowest value
You have a new high value
You have a new low value

Make a list with the original values, minus the highest and lowest values. Adding the new values.

You have a Trimmed Mean

Here’s an example I did real quick to check the math.

And the editor so you can see all the “bubble math” behind the scenes.

This topic was automatically closed after 70 days. New replies are no longer allowed.