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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Ben1981
Helper III
Helper III

Return field name based on ranking measure

Hi, hoping someone can help me with this one;


I have a table with a list of names, a report page with 5 visual cards and a search box. The idea is that the user can type out a first name usch as Ben and the cards 1-5 will be populated with the first 5 names found within the table if any.

 

To help to do this I have created a rank measure that will rank the list of names based upon the search critieria, so for example if there are 7 Bens in the data with various surnames then it will find all 7 and rank them 1 to 7 but those first 5 will show within the cards.

The rank measure is working fine so that however I filter the table the rank measure will correctly rank the filtered data from 1 to x. What I can't figure out how to do is to get the cards to show the report name based on which are rank 1 to 5.


I have tried to write a DAX measure such as....

Report_01 = 
VAR = _rank = [_Ranking]

RETURN

CALCULATE

  (

     SELECTEDVALUE('table'[name]),

     _rank = 1

)

Obviously this has not worked 😞 If anyone knows how I can do this I'd be in your debt!

1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @Ben1981 , 

 

Please give this a try the below measure wher you can pass the ranking measures you have written..

 

TopN_Name =
VAR RankToShow = <index> -- This would be 1 for the first card, 2 for the second, etc.
VAR TopNames =
TOPN(
RankToShow,
ALLSELECTED('table'),[_Ranking], ASC)
RETURN
MAXX(FILTER(TopNames, [_Ranking] = RankToShow),'table'[name])

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

2 REPLIES 2
dharmendars007
Super User
Super User

Hello @Ben1981 , 

 

Please give this a try the below measure wher you can pass the ranking measures you have written..

 

TopN_Name =
VAR RankToShow = <index> -- This would be 1 for the first card, 2 for the second, etc.
VAR TopNames =
TOPN(
RankToShow,
ALLSELECTED('table'),[_Ranking], ASC)
RETURN
MAXX(FILTER(TopNames, [_Ranking] = RankToShow),'table'[name])

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Top marks, works a treat! Thank you 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors