Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 

1 ACCEPTED SOLUTION
littlemojopuppy
Community Champion
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:

  1. As a variable calculate the 95th percentile with the PERCENTILEX.INC function
  2. 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! 🙂

 

View solution in original post

5 REPLIES 5
littlemojopuppy
Community Champion
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:

  1. As a variable calculate the 95th percentile with the PERCENTILEX.INC function
  2. 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! 🙂

 

Anonymous
Not 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]
)
 
3.PNG
 
 
 
 
 
I really do appreciate your support on this 🙂
 
Regards,
Salman

 

Hi @Anonymous did you name the measure?  It doesn't look like there's a name

Anonymous
Not applicable

Hi @littlemojopuppy it worked perfectly! Thank you for the help.

@Anonymous you'rew welcome!  Glad I could help!  🙂

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.