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
Werick
Frequent Visitor

Help to get the top sales person

I have the following table

 

PersonSale amountDate
A22020/04/21
A532020/04/21
A12020/01/25
A582020/01/04
A912020/05/22
A512020/03/08
B422020/04/16
B732020/01/31
B532020/03/28
B522020/03/28
C272020/05/17
C962020/01/01
C962020/05/29
D172020/05/07
D542020/04/27
D592020/04/27
D272020/04/27
D582020/05/07
D662020/01/20
D80

2020/04/09

 

 

I am trying to see who the top overall salesperson is and secondly who the top sales person is for a spesific month.

 

I have tired adding a coloum that calculates the total sales for a person and then Rank that but it does not work as the ranking "sees" the additional values as the same total and then ranks then incorreclty (hope this makes sense)

 

Please help

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Werick ,

 

If you want to get the Top sales person and get the day with the most Sales Person’s sales, please refer the following steps.

 

1. Create a measure to show the TOP sales.

 

TOP sales = 
var _total_person = SUMMARIZE('Table','Table'[Person],"Sales",CALCULATE(SUM('Table'[Sale amount])))
return
MAXX(_total_person,[Person])

 

HELP1.jpg

 

2. Then create a measure to get the date with the most sale person’s sales.

 

Top Sales Date =
VAR _total_person =
    SUMMARIZE (
        'Table',
        'Table'[Person],
        "Sales", CALCULATE ( SUM ( 'Table'[Sale amount] ) )
    )
VAR _max_person =
    MAXX ( _total_person, [Person] )
VAR _total_date =
    SUMMARIZE (
        'Table',
        'Table'[Date],
        'Table'[Person],
        "Sales_a", CALCULATE ( SUM ( 'Table'[Sale amount] ) )
    )
VAR _max_sale =
    MAXX ( FILTER ( _total_date, [Person] = _max_person ), [Sales_a] )
RETURN
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( _total_date, [Sales_a] = _max_sale )
    )

 

HELP2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

View solution in original post

8 REPLIES 8
v-zhenbw-msft
Community Support
Community Support

Hi @Werick ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution.

 

Best regards,

 

Community Support Team _ zhenbw

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

Ashish_Mathur
Super User
Super User

Hi,

You may download my solution file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Nice solution. Thanks.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-zhenbw-msft
Community Support
Community Support

Hi @Werick ,

 

If you want to get the Top sales person and get the day with the most Sales Person’s sales, please refer the following steps.

 

1. Create a measure to show the TOP sales.

 

TOP sales = 
var _total_person = SUMMARIZE('Table','Table'[Person],"Sales",CALCULATE(SUM('Table'[Sale amount])))
return
MAXX(_total_person,[Person])

 

HELP1.jpg

 

2. Then create a measure to get the date with the most sale person’s sales.

 

Top Sales Date =
VAR _total_person =
    SUMMARIZE (
        'Table',
        'Table'[Person],
        "Sales", CALCULATE ( SUM ( 'Table'[Sale amount] ) )
    )
VAR _max_person =
    MAXX ( _total_person, [Person] )
VAR _total_date =
    SUMMARIZE (
        'Table',
        'Table'[Date],
        'Table'[Person],
        "Sales_a", CALCULATE ( SUM ( 'Table'[Sale amount] ) )
    )
VAR _max_sale =
    MAXX ( FILTER ( _total_date, [Person] = _max_person ), [Sales_a] )
RETURN
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( _total_date, [Sales_a] = _max_sale )
    )

 

HELP2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

harshnathani
Community Champion
Community Champion

Hi @Werick ,

 

I assume you must be having a Date Table and a Salesperson Table.

 

If not please create them to get your data modelling correct.

 

The relation should look like Salesperson Table 1 ---> * Sales Table   and   Dates 1 ----> * Sales Table.

 

 

Post that create a measure.

 

Total Sales = Sum(Sales Table[Total Sales])
 
and a Ranking Measure
 
Rank = RANKX(ALL(Salesperson Table [Salesperson Names]), [Total Sales])
 
 
Pull Customer name from Customer Table, Year and Month from Date Table and Rank Measures.
 
 
Apply th visual filter Rank = 1 and you will be able to find the top Salesperson each month.
 
1.jpg
 
 
 
1.jpg
 
 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)


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

 

 

AilleryO
Memorable Member
Memorable Member

Hi,

 

You can use the filter panel to get a TOP N, or you can use formulas depends on what you really want.

If you want to use formulas, maybe you should have a look at :

https://community.powerbi.com/t5/Desktop/DAX-TOP-N-BOTTOM-N-Sales/m-p/523386#M244890

 

Hope this helps, otherwise tell us more.

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.