Forum Discussion
Charline_74
Resolver I
2 years agoHaving an index column in a visual table
Hi On my Power BI report, I have a visual table that fetches columns from several tables. And I'd like to create an index in this visual but I don't know how to do it? Does anyone have a solution?...
- 2 years ago
Charline_74 , You can create a column or measure using RANKX function
For calculated column
Index = RANKX(ALL('Sales'), 'Sales'[OrderDate], , ASC, DENSE)
For measure
IndexMeasure =
VAR CurrentRow = MAX('Sales'[OrderDate])
RETURN
RANKX(ALL('Sales'), 'Sales'[OrderDate], CurrentRow, ASC, DENSE)
manvishah17
Solution Supplier
2 years agoHi Charline_74 ,
Using Power Query Editor:
- Open Power Query Editor: Go to Home > Transform data.
- Add Index Column: Select the table, then Add Column > Index Column > Choose From 0 or From 1.
- Apply Changes: Click Close & Apply.
- Use Index: Drag the index column into your visual table.
Using DAX:
- Create Calculated Column: Go to Modeling > New Column, and use:Index = RANKX(ALL('YourTable'), 'YourTable'[ColumnToOrderBy], , ASC, Dense)
- Use Index: Add the new index column to your visual table.