Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to Rank in a column

Hi 

I have a column hirearchy, and a list of customer ID, Now customers can have only 1 unique ID associated with it, but the column has values like for example 

1. RLE 

2. Treatment 

3. Surgery

4. LRI 

and so on.. 

 

the column hirearchy is based on the fact that if a customer buys 2 RLE i need to count only 1, that was easy with distinctcount, and i managed to do it. BUT now it seems customer can buy and RLE, a TREATMENT and then SURGERY then I need to count 1 and that customer as an RLE Customer. 

if, suppose a customer gets an LRI and then a TREATMENT, then i need to count The customer as a TREATMENT customer.. in this list whatever comes on top, that instance should be counted.. DO ANYONE HAS ANY IDEA HOW I CAN APPROACH THIS ?? YOUR COMMENTS WILL BE VALUABLE  

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    To explain further

     

    the hierarchy should be only counted once, ie for cid 1= count should be 1 and as others 
    IF you look at cid 6, count should again be 1 but for RLE ..I hope you can understand this 

  • PattemManohar's avatar
    PattemManohar
    Icon for Community Champion rankCommunity Champion

    Anonymous Can you put what's your expected output would look like ?

  • Anonymous's avatar
    Anonymous
    Not applicable

    PattemManohar  Iam expecting a matrix as an output in powerbi.. Like the screenshot above

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Not very clear, Why the output of OTHERS is 2, but the output of SBK is 1?

    It makes it easier to give you a solution.

    1. Sample (dummy dataset) data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    Best Regards,
    Community Support Team Gao

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

    • Anonymous's avatar
      Anonymous
      Not applicable

      the grouping has to be done based on customer ID 

      so if you look at others there are two customers who have others ( cid 1 and 4 )

      there are 6 customers who has RLE as the minimum Hierarchy (2,3,5,6,7,9)

      there is 1 customer who has sbk ( 8 )