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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sid10
Helper I
Helper I

Calculating Percentile using Rank and Count

We know that Percentile = Rank/(n+1), where n is the number of values for which the percentiles are being calculated. 

This has worked fine for me in powerbi when the values are distinct. However, if two or more values are similar then the Rank and Percentile fails as shown in the Table below called CQM. E.g. more there many rows with a % score of 0%, and 14.29%. This causes the percentile calculation to mess up (obviously percentiles cannot exceed 100% as is shown in the table below). 

Is there any suggested fix for this? Great appreciate your help. Thank you. 

 

Further details for reference:

Formula for Rank and Percentile are as shown:
LowBirthWt_Rank = IF(ISBLANK([LowBirthWt%_m]), BLANK(), RANKX(ALL(CQM), CALCULATE(SUMX(CQM, [LowBirthWt%_m])), ,ASC, Skip))
LowBirthWt_%ile = DIVIDE([LowBirthWt_Rank], COUNTX(ALL(CQM), CQM[LowBirthWt%_m])+1)

See below:

Sid10_0-1602889170025.png

Requesting @Tahreem24 or anybody else please. 

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Sid10 ,

 

try this.

 

LowBirthWt_%ile = DIVIDE([LowBirthWt_Rank], COUNTX(ALL(CQM), CQM[GrantNumber]))

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

3 REPLIES 3
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Sid10 ,

 

try this.

 

LowBirthWt_%ile = DIVIDE([LowBirthWt_Rank], COUNTX(ALL(CQM), CQM[GrantNumber]))

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Wow! That did it! Thanks a lot.

Just a minor correction. Your formula should be:

LowBirthWt_%ile = DIVIDE([LowBirthWt_Rank],COUNTX(ALL(CQM),CQM[GrantNumber])+1)

 

I am sorry @Sid10 just got time to see your post.

It's great @mwegener has already resolved your issue.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.