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
Anonymous
Not applicable

Help - Rank a dynamic column? I need the rank column for Lookup function.

I have a date column. I created an index column which starts from 1.

 For example:

Items  Rank

a             1

b            2

c            3

d           4

 

When I apply the filter- It shows:

Item   Rank

b          2

c          3

 

But I need something like this -

Item Rank

b         1

c          2

 

And I need to use that Rank column as a Lookup column to find other values.

10 REPLIES 10
Anonymous
Not applicable

hi @Anonymous ,

 

By using your data I write rank function please check two Measures and I shared two outputs also.

Please watch it.

 

--by using ALL function
Rank = RANKX(ALL('Table'),[Sum],,DESC,Skip)
-- by using ALLSELECTED function
Rank = RANKX(ALLSELECTED('Table'),[Sum],,DESC,Skip)

Capture.JPGCapture1.JPG

 

regards,

Naveen

Anonymous
Not applicable

Thanks for your reply.


What is the sum measure?

Anonymous
Not applicable

hi @Anonymous ,

 

Sum = SUM(Table[Number])

regards,

Naveen

Anonymous
Not applicable

Commu1.PNGIndex are the numbers here. But I get 1s in all the column. I'm using index to rank the dates. But ranking dates in my ultimate aim.

 

Kindly let me know what went wrong.

 

Thanks,

Anand!

Anonymous
Not applicable

Comm2.PNG

Also the filters are not working. the Req Id is connected to the Req number.

az38
Community Champion
Community Champion

Hi @Anonymous 

try smth like this

Measure = rankx(ALLSELECTED(Tbl_Rank);CALCULATE(FIRSTNONBLANK(Tbl_Rank[Items];Tbl_Rank[Items]));;ASC)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi,

Thanks for your reply!

But the code did not help.

I'm getting 1 for every row in the table.

It does not sort the remaining rows on the basics of start dates after applying the filters.

 

Thanks

az38
Community Champion
Community Champion

Hi @Anonymous 

It's strange because it works great with any filters applied

could you show all youe data model or *.pbix?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Thanks for your reply.

 

How do we attach our pbix file here?

 

 

az38
Community Champion
Community Champion

@Anonymous 

try cloud storage like https://uploadfiles.io/


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.