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

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

Reply
homeshagarwal
Regular Visitor

Calculating Percentiles vs. Percentiles using Visual Reference Lines

Hi all!
I created a column chart displaying customers' sales and added 2 reference lines- average ($5.63 M) and 80th percentile line ($7.91 M).

Now, I wish to calculate the same percentile value using DAX, I'm getting $731.62M!

Sales Over 80Percentile = CALCULATE(PERCENTILEX.INC(Sales,SUM(Sales[Gross Sales]),.8), ALL(Customers[Customer_ID]))


Could you please guide me on how I can get the same results using DAX??
Percentile calc..png

1 REPLY 1
OwenAuger
Super User
Super User

Hi @homeshagarwal 

One issue with your measure is that SUM ( Sales[Gross Sales] ) needs to be wrapped in CALCULATE (or define a measure and reference that measure instead).

Also, to replicate the behaviour of the percentile line, we have to use ALLSELECTED and remove blanks to ensure the Customers included in the visual are included.

 

Something like:

 

 

Sales Over 80Percentile =
VAR CustomerSales =
    FILTER (
        ADDCOLUMNS (
            ALLSELECTED ( Customers[Customer_ID] ),
            "@Sales", CALCULATE ( SUM ( Sales[Gross Sales] ) )
        ),
        NOT ISBLANK ( [@Sales] )
    )
RETURN
    PERCENTILEX.INC ( CustomerSales, [@Sales], 0.8 )

 

 

Does this work for you?

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.