Forum Discussion
Average and Percentage
Hi All,
I need help in calculating "Average of bottom 95% values in a column".
Thank you in advance for the support!
Regards,
Salman
Hi Anonymous. Define "bottom". I'm going to assume you mean the 95% of records with the lowest values, or discard those records with the highest values.
Here's what you do:- As a variable calculate the 95th percentile with the PERCENTILEX.INC function
- Calculate the sum filtering the table for where the values < the variable calculated in step one.
Here's some code from something similar that I did...
VAR PercentileCutoff = PERCENTILEX.INC ( CalculateDaysToSubmission, [DaysToSubmission], .99 ) RETURN AVERAGEX ( FILTER ( CalculateDaysToSubmission, [DaysToSubmission] >= 0 && [DaysToSubmission] <= PercentileCutoff ), [DaysToSubmission] )Hope this help! 🙂
5 Replies
- littlemojopuppy
Community Champion
Hi Anonymous. Define "bottom". I'm going to assume you mean the 95% of records with the lowest values, or discard those records with the highest values.
Here's what you do:- As a variable calculate the 95th percentile with the PERCENTILEX.INC function
- Calculate the sum filtering the table for where the values < the variable calculated in step one.
Here's some code from something similar that I did...
VAR PercentileCutoff = PERCENTILEX.INC ( CalculateDaysToSubmission, [DaysToSubmission], .99 ) RETURN AVERAGEX ( FILTER ( CalculateDaysToSubmission, [DaysToSubmission] >= 0 && [DaysToSubmission] <= PercentileCutoff ), [DaysToSubmission] )Hope this help! 🙂
- AnonymousNot applicable
Hi littlemojopuppy , thank you for a quick response. And you were right, I wanted to skip out highest values. However, the code you provided is not working for me, for some reason it gives error from "RETURN" till the end. I am not sure what I did wrong, hoping you can help:
VAR M_95% =
PERCENTILEX.INC ( 'Vendor SLA', [Networking Days], .95 )
RETURN
AVERAGEX (
FILTER (
'Vendor SLA',
[Networking Days] >= 0
&& [Networking Days] <= M_95%
),
[Networking Days]
)I really do appreciate your support on this 🙂Regards,Salman- littlemojopuppy
Community Champion
Hi Anonymous did you name the measure? It doesn't look like there's a name