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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How do you calculate Percentiles with dax / Power bi?

So i have a dataset with days to deliver a product that goes like this

Note: An order with DaysToDeliver = 0 means that it was delivered on the same day of purchase, whereas DaysToDeliver = NULL means that it wasn't delivered.

| ItemID | OrderStatus | DateDelivered | DaysToDeliver |
--------------------------------------------------------
| 12145  | canceled    | null          | null          |  
| 12145  | delivered   | 2019-02-01    | 0             |
| 12145  | delivered   | 2019-02-01    | 1             |
| 12145  | delivered   | 2019-02-01    | 1             |
| 12145  | delivered   | 2019-02-01    | 3             |

I need to calculate the percentile 80 by Date Selected ( shown by days, week, month ), but i think im not using the proper formula for calculating the percentile.

I've used the following formulas and got different results with each of them:

FORMULA 1

P80. Leadtime = CALCULATE( 
                    PERCENTILEX.INC( 
                        FILTER( 'LogisticsDB', 'LogisticsDB'[DaysToDeliver] <> BLANK() )
                        ,'LogisticsDB'[DaysToDeliver]
                        , 0.80 
                    )
                    ,USERELATIONSHIP( 
                        Calendar[Date]
                        ,'LogisticsDB'[DateDelivered] 
                    ) 
                )

FORMULA 2

P80. Leadtime = CALCULATE( 
                    PERCENTILE.INC( 
                        'LogisticsDB'[DaysToDeliver]
                        ,0.80 
                    )
                    ,FILTER( 
                        'LogisticsDB'
                        ,'LogisticsDB'[DaysToDeliver] <> BLANK() 
                    )
                    ,USERELATIONSHIP( 
                        Calendar[Date]
                        ,'LogisticsDB'[DateDelivered] 
                    ) 
                )

FORMULA 3

P80. Leadtime = CALCULATE( 
                    PERCENTILE.INC( 
                        'LogisticsDB'[DaysToDeliver]
                        ,0.80 
                    )
                    ,FILTER( 
                        'LogisticsDB'
                        ,'LogisticsDB'[DaysToDeliver] >= 0 
                    )
                    ,USERELATIONSHIP( 
                        Calendar[Date]
                        ,'LogisticsDB'[DateDelivered] 
                    ) 
                )

 

2 REPLIES 2
Anonymous
Not applicable

Ok, apparently this formula does the job. Still if you guys think there is a better way, im open for discussion.

 

P80. Lt Promised = CALCULATE( PERCENTILE.INC( 'LogisticsDB'[DaysToDeliver], 0.80 ),
FILTER( 'LogisticsDB', 'LogisticsDB'[DaysToDeliver] >= 0 ), USERELATIONSHIP( 'LogisticsDB'[DateDelivered], 'Calendar'[Date] ) )

Hi @Anonymous,

 

There could be other ways. But your formula is quite simple. 

 

Best Regards,

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.