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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AlanPhan
Frequent Visitor

Percentile Column with group by

Hello community,

I have one table as below:

 

 

 

Col1 Col2 Value Percentile
Test John  100     0.0
Test John  200     0.0
Test John  300     0.0
Test John  100     0.1
Test John  200     0.1
Test John  300     0.1
Test John  100     1.00
Test John  200     1.00
Test John  300     1.00

 

 

Percentile column is the range to calculate percentile with range from 0.0 to 1.0

 

How to calculate percentile based on two column 'Value' and 'Percentile' and group by Col1, Col2, Percentile.
I want to have new table like this:

 

 

 

 

Col1 Col2 Percentile   Percentile_Value
Test John  0.0          100
Test John  0.1          100
Test John  1.0          300

 

 

 

Any helps will be appriciated.

 

2/ Or with this table:

 

 

Col1 Col2 Value
Test John  100
Test John  200
Test John  300

 

How can I calculate Percentile (group by Col1, Col2) with range from 0 to 1 (0.0, 0.1, 0.2.... 0.98, 0.99, 1.00)?

9 REPLIES 9
v-xinruzhu-msft
Community Support
Community Support

Hi @AlanPhan ,

 

 Maybe you can create a new measure in the table , the code is as follows:

Measure 2 = CALCULATE(PERCENTILE.INC('Table'[value],SELECTEDVALUE('Table'[Percentile])),'Table'[Percentile]=SELECTEDVALUE('Table'[Percentile]),ALL('Table'))

))

 

Then add a ‘Table’  visual and put ‘col1’ ‘col2’ ‘percentile’ fields and measure2 to the table, the output is as follows:

vxinruzhumsft_0-1669344798633.png

 

 

This is the median I calculated for each group, whether it meets your needs, I found that the median calculated by the second group is different from the result in the picture you provided, could you provide the calculation logic?

 If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi @v-xinruzhu-msft ,

I want to have a table as above, with each row will have 100 point (range from 0 to 1) for 'Value' array, so that I can show on the chart.

With your result, how can I show to line chart with enough 100 point?

Hi @AlanPhan 

 

What you describe is a bit abstract, is there a similar graphic description?

 

Best Regards,

Yolo Zhu

 

@v-xinruzhu-msft , 

You can see the line chart as below, I want to have 100 points for each percentile (range from 0 to 1). Is it possible?

powerbi-chart1.JPG

NikhilChenna
Continued Contributor
Continued Contributor

AlanPhan, i think you should create a rank column based on value and percentile column and filter the data accordingly. 

Regards,
Nikhil Chenna 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

could you have a sample for this? I tried to create 2 table (Percentile with Value column, data from 0 to 1), and table need to be calculated. But it seems difficult to implement.

Hi @AlanPhan , right now i do not have an example to show you. 
But you can check for Rankeq funtion.

 

Regards,
Nikhil Chenna 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

FreemanZ
Super User
Super User

don't understand the percentile here, could you explain the calculation behind?

hi @FreemanZ , 
I updated post again. Also, please see the note 2/ that I mentioned below. It's easy to understand. 
Please advise. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.