Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Microsoft Employee
Microsoft 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.