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
Kazu
Helper II
Helper II

INDEX function and ORDERBY

I would like to define a measure which use INDEX(). The test measure blow specifies hardcoded "2" in the INDEX() function and it returns "B", which if I understand correctly is the second Name in the alphabethical order of Name. 

Kazu_0-1718231264412.png

 

Now, how can I get the second name in the order of Sort column instead of Name column? I want "A" instead of "B" because its Sort value is "2" and considered the second". I tried to add ORDERBY like below but it did not allow me to select other columns than Name. I guess I should avoid using VALUES but use ADDCOLUMNS or something, but couldn't figure out how to do it.

 

Kazu_1-1718231607750.png

 

 

1 ACCEPTED SOLUTION
Kazu
Helper II
Helper II

I am not sure if this would be of help for anybody else, but I found a solution.

Kazu_1-1718244703121.png

 

View solution in original post

4 REPLIES 4
Kazu
Helper II
Helper II

I am not sure if this would be of help for anybody else, but I found a solution.

Kazu_1-1718244703121.png

 

Anonymous
Not applicable

Hi, @Kazu 

Glad to hear you solved the problem yourself!  

 

Best Regards

Yongkang Hua

 

lbendlin
Super User
Super User

Instead of VALUES('Table'[Name]) use VALUES('Table'[Sort])

Thanks but that would return "2" instead of "A". I found a solution myself.

 

Kazu_0-1718244445308.png

 

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.