Forum Discussion

RaffiKouzoudj's avatar
RaffiKouzoudj
Helper III
6 years ago
Solved

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)

  • V-lianl-msft's avatar
    V-lianl-msft
    6 years ago

    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.

3 Replies

    • RaffiKouzoudj's avatar
      RaffiKouzoudj
      Helper III

      Dear 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

       

       
      • V-lianl-msft's avatar
        V-lianl-msft
        Community Support

        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.