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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Segment data based on percentile by group

Greetings,

 

I have a table like this one:

GROUPVALUE
A1
B10
A2
A2
A3
B12
B15
A2
B18
B14

 

I´d like to find percentiles by group so I can filter the data that is too high or too low for each group:

GROUPVALUEP20P80FILTER
A1130
B1010180
A2131
A2131
A3130
B1210181
B1510181
A2131
B1810180
B1410181

 

Segmented data:

GROUPVALUE
A2
A2
B12
B15
A2
B14

 

Anyone knows how to find percentiles by group either on DAX or Power Query? I´ve been looking but haven´t found something like this.

 

Thanks, best regards,

Alejandro.

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

 

You can download my proposed solution here.

 

Here are the DAX formulas for the 3 calculated columns:

 

1) 20th percentile

Perc 20 = 
VALUE(PERCENTILEX.EXC(
    FILTER('Table' ,[GROUP]=EARLIER('Table'[GROUP]) )
    ,[VALUE] , 0.2))

2) 80th percentile

Perc 80 = 
VALUE(PERCENTILEX.EXC(
    FILTER('Table' ,[GROUP]=EARLIER('Table'[GROUP]) )
    ,[VALUE] , 0.8))

3) Filter

Filter = IF([VALUE]>[Perc 20] && [VALUE]<[Perc 80],1,0)

Finally, here is a screenshot of what it looks like.

Percentiles-table

 

Does this help you?

 

Do not hesitate if you have more questions.

 

LC

Interest in Power BI and DAX templates? Check out my blog at www.finance-bi.com

View solution in original post

2 REPLIES 2
lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

 

You can download my proposed solution here.

 

Here are the DAX formulas for the 3 calculated columns:

 

1) 20th percentile

Perc 20 = 
VALUE(PERCENTILEX.EXC(
    FILTER('Table' ,[GROUP]=EARLIER('Table'[GROUP]) )
    ,[VALUE] , 0.2))

2) 80th percentile

Perc 80 = 
VALUE(PERCENTILEX.EXC(
    FILTER('Table' ,[GROUP]=EARLIER('Table'[GROUP]) )
    ,[VALUE] , 0.8))

3) Filter

Filter = IF([VALUE]>[Perc 20] && [VALUE]<[Perc 80],1,0)

Finally, here is a screenshot of what it looks like.

Percentiles-table

 

Does this help you?

 

Do not hesitate if you have more questions.

 

LC

Interest in Power BI and DAX templates? Check out my blog at www.finance-bi.com

Anonymous
Not applicable

That works, thanks for the help.

 

I got this error with the production data though:

The percentile value should be in the range 1/(N+1)..N/(N+1) inclusive, where N is the number of data values

error.png

 

Changing from PERCENTILEX.EXC to PERCENTILEX.INC solved it. 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors