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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
gra_197
Helper I
Helper I

Calculate top 6 clients in descending order

Hi

 

I am hoping you can help me.

 

I need to get a list of top 6 clients based on the highest sales volume

Secondly I want to get an average of the volume of these clients over the total client volume by sales

 

Thanks

G

1 ACCEPTED SOLUTION

Thanks for the @ so I would come back

 

Supponsing you have a Sales measure ( [Sales] )

 

Sales Top 2 =
VAR Top2Cust =
    TOPN( 2, ALL( Customer[Custkey] ), [Sales], DESC)
RETURN
CALCULATE( [Sales], KEEPFILTERS( Top2Cust) )
 
Sales Top 2 Pct = DIVIDE ( [Sales Top 2], [Sales] )
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

View solution in original post

6 REPLIES 6
v-hashadapu
Community Support
Community Support

Hi , Thank you for reaching out to the Microsoft Community Forum.

 

To help you identify your top clients and measure their impact on your overall sales, we built a Power BI report using two tables based on the details provided by you: Customers and Sales, connected by a relationship on CustKey. We created DAX measures to calculate total sales, the combined sales of your top 2 clients and the percentage those top clients contribute to the total. This gives you a clear view of who your highest-value clients are and what share of your revenue they represent.

Please check the attached .pbix file and share your thoughts.

gra_197
Helper I
Helper I

Hi all, just to give some context. Im looking for the top 2 Clients here based on sales and want to get the percentage based on the overall volume and sales amount

@FBergamaschi 

 

1000054477.jpg

1000054478.jpg

Thanks for the @ so I would come back

 

Supponsing you have a Sales measure ( [Sales] )

 

Sales Top 2 =
VAR Top2Cust =
    TOPN( 2, ALL( Customer[Custkey] ), [Sales], DESC)
RETURN
CALCULATE( [Sales], KEEPFILTERS( Top2Cust) )
 
Sales Top 2 Pct = DIVIDE ( [Sales Top 2], [Sales] )
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

@gra_197 

 

is mine or somebody else's answer a solution?

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Jihwan_Kim
Super User
Super User

Hi, 

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1752079587083.png

 

 

Jihwan_Kim_0-1752079571207.png

 

función WINDOW (DAX) - DAX | Microsoft Learn

 

Sales: = 
SUM( sales[sales] )

 

Sales top 6 clients: = 
CALCULATE (
    [Sales:],
    KEEPFILTERS (
        WINDOW (
            1,
            ABS,
            6,
            ABS,
            ALL ( customer[customer] ),
            ORDERBY ( [Sales:], DESC )
        )
    )
)

 

Average sales top 6 clients: = 
IF (
    [Sales top 6 clients:],
    AVERAGEX ( ALL ( customer[customer] ), [Sales top 6 clients:] )
)

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
FBergamaschi
Solution Sage
Solution Sage

Hi,

without tables, model etc the only thing we can do is give you the DAX code  of a generic measure for the Sales of the top 6 customers based on sales itself

 

Sales Top6 =
VAR Top=
    TOPN( 6, ALL( Cust[Custkey] ), [Sales], DESC)
RETURN
SUMX ( KEEPFILTERS(Top), [Sales] )
 
The second question in unclear to me, can you rephrase it and show an example?
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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