Forum Discussion

abc_777's avatar
abc_777
Icon for Solution Specialist rankSolution Specialist
1 year ago
Solved

item wise dynamic customer rank

Hello 

 

i have item table and customer table and quantity customer bought

 

i want to create dynamic rank accordingly to customer purchase in different items

 

 Customer 1Customer 2Customer 3Customer 4Customer 5Customer 6
Item A134254
Item B242345
Item C351423
Item D423132
Item E515511

 

in this sample table Item A is mostly bought by Customer 1 so rank is 1 but item A is not mostly bought by customer 2 so for cusotmer 2 itsm A rank is 3 

 

again Item E is mostly bough by customer 2, customer 5 and cusotmer 6 but not to others. 

i want this dynamic item wise cusotmer item quantity purchase RANK in a dynamic way

 

can some one help please

 

thanks

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the replies from ahmedoye  and Ashish_Mathur.

     

    Hi  abc_777,

     

    Please try the following steps:

     

    1. In Power Query Editor, select the first column and unpivot the other columns.

     

    2. Modify column names and delete useless data.

     

    3. Create a measure:

     

    Rank = RANKX(ALLEXCEPT('Table','Table'[sub_category_name]),CALCULATE(SUM('Table'[sales in kg])),,DESC,Dense)

     

     

    4. Create a matrix:

     

    Best Regards,
    Zhu
    Community Support Team

     

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

7 Replies

  • ahmedoye's avatar
    ahmedoye
    Icon for Responsive Resident rankResponsive Resident

    Hi, this seems like your final solution right? I assume you have a measure already that counts or sums for each item? Now you need a ranking formula to provide the results as displayed in your attached image?

    • abc_777's avatar
      abc_777
      Icon for Solution Specialist rankSolution Specialist

      Hi ahmedoye ,

       

      i have all those sum and count. I have rank but not like this dynamic way. item wise quantity purchase rank for each customer . it could happen that an item that customer 1 purchase a lot might not purchase to other customer. so i want to see the comparison 

       

      thanks

  • Hi,

    You have shared the end result (not the source data).  Atleast share some data to work with.

  • abc_777's avatar
    abc_777
    Icon for Solution Specialist rankSolution Specialist

    Ashish_Mathur  , here is item wise customer purchae quantty data

     

    CUSTOMER_FIRST_NAMECustomer ACustomer BCustomer CCustomer DCustomer ECustomer FCustomer GCustomer HCustomer ICustomer JCustomer KCustomer LCustomer MCustomer NCustomer OCustomer PCustomer QCustomer RCustomer SCustomer T
    sub_category_namesales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kgsales in kg
    BEEF BONE IN1276.00 1430.00   0.00   4.001755.00 774.0081.00117.00 123.0077.0032.00
    BEEF BY PRODUCT      20.00  15.30 75.00        
    BEEF BY PRODUCT CARCASS      22.00             
    BEEF COLD CUTS4.00  2592.00  32.40 15.00 0.60        8.00
    BEEF FROZEN PACKET          0.63         
    BEEF MEAT TRIM56.00 10.0035049.40         16.00 4.00 4.00 80.00
    BEEF MEAT TRIM MARINATION        502.70      0.00    
    Beef Primal58.30   6.405.30124.8516.10 151.100.20 7.00      2.00
    Beef Sub-Primal246.30   17.80 526.90  63.503.9010.004.00  0.00 3.70 16.80
    CHICKEN BONE IN37.00  1670.00              0.00 
    CHICKEN BONELESS&PRIMALS MARIN               0.00    
    CHICKEN COLD CUTS   50.0040.00 54.00            3.00
    CHICKEN FROZEN PACKET          1.26        0.54
    CHICKEN MEAT TRIM MARINATION         52.3012.80    0.00   4.60
    Chicken Primal559.00  8738.00      72.00  13724.004598.0010631.001630.007427.0012005.0085.00
    Chicken Sub-Primal10.00 0.001708.00  89.00   2.0021.00       10.00
    FISH BONELESS          6.00  1.00      
    Marinated Fish   0.00                
    MUTTON BONE IN65.00  0.00       829.00   0.00   10.00
    MUTTON BY PRODUCT CARCASS      149.00             
  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the replies from ahmedoye  and Ashish_Mathur.

     

    Hi  abc_777,

     

    Please try the following steps:

     

    1. In Power Query Editor, select the first column and unpivot the other columns.

     

    2. Modify column names and delete useless data.

     

    3. Create a measure:

     

    Rank = RANKX(ALLEXCEPT('Table','Table'[sub_category_name]),CALCULATE(SUM('Table'[sales in kg])),,DESC,Dense)

     

     

    4. Create a matrix:

     

    Best Regards,
    Zhu
    Community Support Team

     

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

    • abc_777's avatar
      abc_777
      Icon for Solution Specialist rankSolution Specialist

      thanks buddy, the formula u gave didnt work but some how i get the concept and able to made that as my tables for item and customers are different. anyways. it works. thanks again. cheers