Forum Discussion

PaulDBrown's avatar
PaulDBrown
Icon for Community Champion rankCommunity Champion
6 years ago
Solved

Calculated column for RANK by product and person

Good morning,

 

Can someone help me with this? I am trying to create a calculated column which creates a rank based on product by sales person. The rank itself establishes the order by date. In other words, a sales person has a number of products which they sell consecutively: for example, "James" sells product "A" from the 25 May until 1st June, and then moves onto product "F" for a few days and then another product (etc). What I am interested is in establishing the order by date a person has sold each product.

 

I have suceeded in establishing the total order of products sold using the RANK.Q function with the related date, but I can't seem to find the way to establish this order by person and product.

 

This is the original table:

 

DateMin date Product and sales personProductSales PersonRank by Product min Date 
27/05/2019 0:0027/05/2019 0:00AJames1 
28/05/2019 0:0027/05/2019 0:00AJames1 
29/05/2019 0:0027/05/2019 0:00AJames1 
30/05/2019 0:0027/05/2019 0:00AJames1 
31/05/2019 0:0027/05/2019 0:00AJames1 
01/06/2019 0:0027/05/2019 0:00AJames1 
01/06/2019 0:0001/06/2019 0:00APeter7 
02/06/2019 0:0001/06/2019 0:00APeter7 
02/06/2019 0:0002/06/2019 0:00FJames13 
03/06/2019 0:0001/06/2019 0:00APeter7 
03/06/2019 0:0002/06/2019 0:00FJames13 
04/06/2019 0:0001/06/2019 0:00APeter7 
04/06/2019 0:0002/06/2019 0:00FJames13 
05/06/2019 0:0001/06/2019 0:00APeter7 
05/06/2019 0:0002/06/2019 0:00FJames13 
06/06/2019 0:0006/06/2019 0:00AAna19 
06/06/2019 0:0001/06/2019 0:00APeter7 
06/06/2019 0:0002/06/2019 0:00FJames13 
07/06/2019 0:0006/06/2019 0:00AAna19 
07/06/2019 0:0007/06/2019 0:00BPeter25 
07/06/2019 0:0002/06/2019 0:00FJames13 
08/06/2019 0:0006/06/2019 0:00AAna19 
08/06/2019 0:0007/06/2019 0:00BPeter25 
08/06/2019 0:0008/06/2019 0:00CJames31 
09/06/2019 0:0006/06/2019 0:00AAna19 
09/06/2019 0:0007/06/2019 0:00BPeter25 
09/06/2019 0:0008/06/2019 0:00CJames31 
10/06/2019 0:0006/06/2019 0:00AAna19 
10/06/2019 0:0007/06/2019 0:00BPeter25 
10/06/2019 0:0008/06/2019 0:00CJames31 
11/06/2019 0:0006/06/2019 0:00AAna19 
11/06/2019 0:0007/06/2019 0:00BPeter25 
11/06/2019 0:0008/06/2019 0:00CJames31 
12/06/2019 0:0007/06/2019 0:00BPeter25 
12/06/2019 0:0008/06/2019 0:00CJames31 
12/06/2019 0:0012/06/2019 0:00FAna36 
13/06/2019 0:0013/06/2019 0:00CPeter42 
13/06/2019 0:0012/06/2019 0:00FAna36 
13/06/2019 0:0013/06/2019 0:00GJames42 
14/06/2019 0:0013/06/2019 0:00CPeter42 
14/06/2019 0:0012/06/2019 0:00FAna36 
14/06/2019 0:0013/06/2019 0:00GJames42 
15/06/2019 0:0013/06/2019 0:00CPeter42 
15/06/2019 0:0012/06/2019 0:00FAna36 
15/06/2019 0:0013/06/2019 0:00GJames42 
16/06/2019 0:0013/06/2019 0:00CPeter42 
16/06/2019 0:0012/06/2019 0:00FAna36 
16/06/2019 0:0013/06/2019 0:00GJames42 
17/06/2019 0:0013/06/2019 0:00CPeter42 
17/06/2019 0:0012/06/2019 0:00FAna36 
17/06/2019 0:0013/06/2019 0:00GJames42 
18/06/2019 0:0018/06/2019 0:00CAna52 
      
     

 

And what I'm trying to get is the final column ("expected ranking")

 

 

 

Thanks!

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    PaulDBrown 

    Column = 
    VAR _name = 'Table'[Sales Person]
    RETURN RANKX(FILTER('Table','Table'[Sales Person]=_name),'Table'[Min date Product and sales person],,ASC,Dense)

    please create a calculated column