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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Top Salesperson displayed in a card

I need to display in a card, the name of the salesperson with the highest number of sales. I feel like this must be simpler than the solutions i've tried (unsuccessfully).


I want to display in a card the name of the sales person who has the highest value in another column of the same table, 'OrderQty'.

I want just the name, not the associated value. Any advice would be greatly appreciated. I feel like this is a simple generic problem, that I've been googling and trying to figure out for too long, but if needed i can provide more detail/data.


 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous

 

Try the following measure: 

 

 

Top Seller =
VAR temp_table =
    SUMMARIZE (
        ALL ( Sales[Salesperson] );
        Sales[Salesperson];
        "SalesTotalValue"; SUM ( Sales[SalesTotal] )
    )
RETURN
    CALCULATE (
        MAX ( Sales[Salesperson] );
        FILTER (
            ADDCOLUMNS ( temp_table; "Rank"; RANKX ( temp_table; [SalesTotalValue] ) );
            [Rank] = 1
        )
    )

Check the PBIX file attach with the result, this can need some changes depeding on your table setup.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

5 REPLIES 5
MFelix
Super User
Super User

Hi @Anonymous

 

Try the following measure: 

 

 

Top Seller =
VAR temp_table =
    SUMMARIZE (
        ALL ( Sales[Salesperson] );
        Sales[Salesperson];
        "SalesTotalValue"; SUM ( Sales[SalesTotal] )
    )
RETURN
    CALCULATE (
        MAX ( Sales[Salesperson] );
        FILTER (
            ADDCOLUMNS ( temp_table; "Rank"; RANKX ( temp_table; [SalesTotalValue] ) );
            [Rank] = 1
        )
    )

Check the PBIX file attach with the result, this can need some changes depeding on your table setup.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks @MFelix glad I found your thread !!!

Any way I can add another criteria to this measure? 

I want to replicate the sorting order by Total points and Hired/HC in the ranking measure:

Caesarul_1-1675882725801.png

 

 

 



Hi @Caesarul ,

 

In this case you need to find a calculation based on your two columns since we are talking about have both of them sorted by the max and they are both numbers you can simply sum them together try this code:

 

Top Seller = 
VAR temp_table =
    SUMMARIZE (
        ALL ( 'GSW Active'[Country] ),
        'GSW Active'[Country],
        "GSWTotal", SUM ( 'GSW Active'[Total Point] ) + SUM('GSW Active'[Hired/HC])
    )
RETURN
    CALCULATE (
        MAX ( 'GSW Active'[Country]),
        FILTER (
            ADDCOLUMNS ( temp_table, "Rank", RANKX ( temp_table, [GSWTotal] ) ),
            [Rank] = 1
        )
    )

 

MFelix_0-1675894293112.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks @MFelix saved me again! 

Anonymous
Not applicable

Thank You! You've helped me understand how to set the arguments up for the functions used as well!

note for other users: You need to change the semicolons to commas from the code snippet and it works perfectly! Or download his attached PBIX.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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