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

Dynamic Rank of a Text column

Hi All,

 

  I am trying to find the rank of a column(Full Name) dynamically on selection of each slice(LevelName) which is of type Text.

 

  Any suggestion to get it.

 

TeamList.PNG

 

 

Thanks,

Sud

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

1. Add an index column in the Query Editor,

2. Create a measure like this.

Measure =
RANKX ( ALL ( 'Table1'[FullName] ), CALCULATE ( SUM ( 'Table1'[Index] ) ) )

3. You can try out in this file.

Dynamic_Rank_of_a_Text_column

Best Regards,

Dale

 

Community Support Team _ Dale
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

14 REPLIES 14
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

The question is how to rank the [FullName]? For example, if we choose "Team Zuid West", how to rank the 10 FullNames? Who is the first, the second... ?

Usually, there could be another column of values. 

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-jiascu-msft,

 

  I need to have another column which will give me rank/index which changes dynamically.

 

  On first load I need all the FullNames to be indexed from 1 in any order and where on click of any team I need the team members corresponding to that team starting with index 1.

 

  I hope I am clear here.

 

Thanks,

Sud

Hi @Anonymous,

 

1. Add an index column in the Query Editor,

2. Create a measure like this.

Measure =
RANKX ( ALL ( 'Table1'[FullName] ), CALCULATE ( SUM ( 'Table1'[Index] ) ) )

3. You can try out in this file.

Dynamic_Rank_of_a_Text_column

Best Regards,

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MarcelBeug
Community Champion
Community Champion

My suggestion would be to rephrase your question and provide more details.

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Hi @MarcelBeug,

 

 I have updated my question and attached a sample.

 

 Let me know if you need anything else.

 

Thanks,

Sud

Some expected results would be helpful, but maybe you are looking for this DAX calculated column:

 

Rank = RANKX(FILTER(Table1, Table1[LevelName] = EARLIER(Table1[LevelName])),Table1[FullName])
Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Hi @MarcelBeug,

 

  I get error when using EARLIER DAX function.

 

Thanks,

Sud

Probably your culture has a different delimiter.

 

 

 

 

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Hi @MarcelBeug,

 

  I have loaded the data directly SQL server. So not sure if anything is missing here.

 

Thanks,

Sud

Some information from you is missing here, like the error message you get.

 

Anyhow, what I meant is that you probably need to replace the comma delimiters by semicolons:

 

Rank = RANKX(FILTER(Table1; Table1[LevelName] = EARLIER(Table1[LevelName]));Table1[FullName])
Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Hi @MarcelBeug,

 

  From my end comma delimiter works fine. Here is the below error I get when I try to have the EARLIER function.

 

Error.PNG

 

Thanks,

Sud

Try and replace Levelname by LevelName.

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

hI @MarcelBeug,

 

  I was putting the rank formula in a Measure so I was getting error. Now I get the rank but the same rank comes for many users.

 

 

TeamList.PNG

 

i tried using dense in Rank function.

 

Thanks,
Sud

I can't see nothing wrong in the information you provided.

So it must be something in the information you didn't provide (again...).

Specializing in Power Query Formula Language (M)

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.