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

How to rank Unique ID Per group

I tried to achive this but not successful. I like ranking Unique Person ID per Address ID. I used a number of solutions in this forum but they all do ranking per record.

Address ID        Address                PersonID (who lives there)   Item              Rank

1                       New York              300                                       TV                 1 

1                       New York              300                                       PC                 1

1                       New York              300                                       Laptop          1

1                       New York              301                                       Watch           2

2                       LA                          400                                       Car               1

2                       LA                          400                                       TV                1

3                       London                  500                                       Car              1

...................................                 

 

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

@os_ca,

 

You may add a calculated column as follows.

Column =
RANKX (
    FILTER ( Table1, Table1[Address ID] = EARLIER ( Table1[Address ID] ) ),
    Table1[PersonID],
    ,
    ASC,
    DENSE
)
Community Support Team _ Sam Zha
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

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@os_ca,

 

You may add a calculated column as follows.

Column =
RANKX (
    FILTER ( Table1, Table1[Address ID] = EARLIER ( Table1[Address ID] ) ),
    Table1[PersonID],
    ,
    ASC,
    DENSE
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks. Your solution works but there is another issue i am facing. As soon as the list has got a filter, the filter is ignored for the ranking the list but is applied for displaying only.

eg.

  Person ID 301,400,500 are selected in a person filter. Then the list shows the below. Is there any workaround to fix the problem? Person 1 still be counted only for ranking process.

 

 address id     Person ID            Ranking                                   

  1                     301                             2              -->It should be ranking 1 now because person 300 is excluced in the filter.

  2                     400                             1

  2                     400                             1

  3                     500                             1 

  ...... 

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.