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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
lefli85
Frequent Visitor

DAX Exclude Bottom 5% sales and calculate 75th percentile of the top 95% sales

Hello,

I need help with DAX that calculate the 75th percentile of sales the top 95% salespeople by sales. I have attached a Excel snippet of expected results. Sales highlighted in yellow need to be excluded from the table of users that will be used to calculate the 75th percentile. I can calculated the percentile in DAX but stuck on filtering out the bottom 5% salespeople

--sales percentile
VAR Percentile75 = 0.75
 --bottom 5% salespeople to be excluded
VAR SalespeopleExcluded = 0.05
--selected state
VAR StateinContext =
    SUMMARIZE ( 'Sales', 'Sales'[State] ) 

--total sales for entire state
VAR TotalSales =
    CALCULATE (
        [Sales],
        StateinContext,
        ALL('Sales'[Salesperson]),

    )
VAR SalesBySalesperson =
    FILTER (
        CALCULATETABLE (
            ADDCOLUMNS (
                CALCULATETABLE (
                    SUMMARIZE (
                        'Sales',
                        'Sales'[Salesperson]

                    )
                ),
                "@SalespersonProportionofSales%", CALCULATE ( DIVIDE ( [Sales], TotalSales ) ),
                "@Sales", [Sales]
            ),
            ALL ( 'Sales'[Salesperson] )
            ,StateinContext
        ),
        [@SalespersonProportionofSales%] > SalespeopleExcluded
            && [@Sales] <> BLANK ()
    )
VAR Result =
    CALCULATE (
        PERCENTILEX.INC (
            SalesBySalesperson,
            [@Sales],
            Percentile75
        )
    )
RETURN
Result

 

lefli85_0-1666232303317.png

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below, and I hope the below can provide some ideas on how to create a solution for your datamodel.

All measures are in the attached pbix file.

In the below, by using the measure [Percentage cumulate except bottom 5%:], the desired result can be shown.

 

Jihwan_Kim_0-1666236475370.png

 

 

 


 

    Microsoft MVP
 

 

   


      If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


   


     
        LinkedInVisit my LinkedIn page
     

   


   


     
        Outlook BookingSchedule a short Teams meeting to discuss your question

     

   


 


View solution in original post

3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

It's nothing but just 75%*95%=71.25% percentile of the whole set.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below, and I hope the below can provide some ideas on how to create a solution for your datamodel.

All measures are in the attached pbix file.

In the below, by using the measure [Percentage cumulate except bottom 5%:], the desired result can be shown.

 

Jihwan_Kim_0-1666236475370.png

 

 

 


 

    Microsoft MVP
 

 

   


      If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


   


     
        LinkedInVisit my LinkedIn page
     

   


   


     
        Outlook BookingSchedule a short Teams meeting to discuss your question

     

   


 


Thank you @Jihwan_Kim 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.