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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
RaffiKouzoudj
Helper III
Helper III

Create Index on Visual Table

Hello,

I have a visual table (created from other tables). I am wondering how can I create an index column on this table.

on this table I do not have the option of using M Query (edit query) since this is a visual table. I want to have a DAX query to create this index column. I just want this column to use it later on with the TOP N feature. Thank you.

Table.AddIndexColumn(#"Added Custom1", "Index", 0, 1)

1 ACCEPTED SOLUTION

Hi @RaffiKouzoud,

 

Sorry, Based on the results you expect,RANKX needs a unique column as a condition to sort.

The alternative is to use M query in the original table to add index columns first, and then use DAX to create a new table, which needs to contain the index columns previously added.

Then use the RANKX function to sort the new table according to the index columns in the new table.

 

Best Regards,
Liang
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

3 REPLIES 3
amitchandak
Super User
Super User

It can be done using Rank.

For Rank Refer these links

https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Capture.PNGDear Amit,

Thank you for your reply, i have reviewed all the 3 links. The issue with my data is that I do not have any integer indicator (value). however, I just want to use DAX on my visual table to list series of number. This series of (unique) number will help me use TOP N filtering. Currently, i used the below code. where I used "Focal Point NAme" which is not unique however this value is repeated less than other indicators. So the RANKX generated numbers however they are not unique value.

 

Main Index = RANKX(ALLSELECTED(Main_Table),CALCULATE(MAX(Main_Table[focal_point_name])),,ASC,Dense)

 

So my question is that how to use DAX Measure to generate incremental row value on the visual table. That is 1,2,3,4,..... N Count. Thank you

 

 

Hi @RaffiKouzoud,

 

Sorry, Based on the results you expect,RANKX needs a unique column as a condition to sort.

The alternative is to use M query in the original table to add index columns first, and then use DAX to create a new table, which needs to contain the index columns previously added.

Then use the RANKX function to sort the new table according to the index columns in the new table.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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