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
DietmarF
New Member

Percentile calculation not correct

Hello,

 

I have a table which has one line per Step and a Column for a SUM how often the Step occured.
I am creating a CDF for this table. That works fine.
But I am not able to calculate a P10. The values are not correct.

I tried it in this way.

P10  = CALCULATE(PERCENTILEX.INC(Tabelle1,Tabelle1[Step], 0.5),values (Tabelle1[SUM_Events]))
 
Table is looking like this
 
StepSUM_Events
15
220
340
420
550
 
 P10 is with my calculation 3. So the SUM_Events are not used at all for calcualtion.
1 ACCEPTED SOLUTION
SolomonovAnton
Super User
Super User

You're correct — the issue stems from misunderstanding how PERCENTILEX.INC works. This function treats the column values equally and doesn’t weight them based on frequency (your SUM_Events). To calculate P10 (10th percentile) correctly from a cumulative distribution, you need to weight the steps by frequency.

Here’s how you can implement a correct weighted percentile calculation using DAX:

🔧 Step-by-Step Weighted P10 Calculation

  1. Create a cumulative table to represent your empirical distribution function (CDF).
  2. Calculate the cumulative frequency to identify where the P10 lies.

Correct DAX Measure for Weighted P10

P10_Correct = VAR TotalEvents = SUMX(ALL(Tabelle1), Tabelle1[SUM_Events]) VAR PctTarget = 0.1 * TotalEvents RETURN MINX( FILTER( ADDCOLUMNS( SUMMARIZE(Tabelle1, Tabelle1[Step]), "CumSum", CALCULATE(SUM(Tabelle1[SUM_Events]), FILTER(ALL(Tabelle1), Tabelle1[Step] <= EARLIER(Tabelle1[Step]))) ), [CumSum] >= PctTarget ), Tabelle1[Step] )

Explanation:

  • TotalEvents computes total occurrences.
  • PctTarget calculates the position where 10% of events lie.
  • ADDCOLUMNS + FILTER finds the first step where cumulative events exceed 10% of total.

Optional: You can enhance the precision by interpolating between steps if needed, but this provides the correct step-level P10.

Try using this measure in your report and compare the result with your expected percentile. Let me know if you want to add interpolation for exact value.

✔️ If my message helped solve your issue, please mark it as Resolved!

👍 If it was helpful, consider giving it a Kudos!

View solution in original post

1 REPLY 1
SolomonovAnton
Super User
Super User

You're correct — the issue stems from misunderstanding how PERCENTILEX.INC works. This function treats the column values equally and doesn’t weight them based on frequency (your SUM_Events). To calculate P10 (10th percentile) correctly from a cumulative distribution, you need to weight the steps by frequency.

Here’s how you can implement a correct weighted percentile calculation using DAX:

🔧 Step-by-Step Weighted P10 Calculation

  1. Create a cumulative table to represent your empirical distribution function (CDF).
  2. Calculate the cumulative frequency to identify where the P10 lies.

Correct DAX Measure for Weighted P10

P10_Correct = VAR TotalEvents = SUMX(ALL(Tabelle1), Tabelle1[SUM_Events]) VAR PctTarget = 0.1 * TotalEvents RETURN MINX( FILTER( ADDCOLUMNS( SUMMARIZE(Tabelle1, Tabelle1[Step]), "CumSum", CALCULATE(SUM(Tabelle1[SUM_Events]), FILTER(ALL(Tabelle1), Tabelle1[Step] <= EARLIER(Tabelle1[Step]))) ), [CumSum] >= PctTarget ), Tabelle1[Step] )

Explanation:

  • TotalEvents computes total occurrences.
  • PctTarget calculates the position where 10% of events lie.
  • ADDCOLUMNS + FILTER finds the first step where cumulative events exceed 10% of total.

Optional: You can enhance the precision by interpolating between steps if needed, but this provides the correct step-level P10.

Try using this measure in your report and compare the result with your expected percentile. Let me know if you want to add interpolation for exact value.

✔️ If my message helped solve your issue, please mark it as Resolved!

👍 If it was helpful, consider giving it a Kudos!

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.