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)
shafiz_p
Super User
2 years agoHi, Charline_74 If you don't have column with unique values, and have multiple columns in the table, then you can use rownumber function to create index column with a combination of all the columns in your table. For example,
Index =
ROWNUMBER(ALLSELECTED('Table'[Column1], 'Table'[Column2], 'Table'[Column3], 'Table'[Column4]))
Basically Dax don't have any exact function to create index column. You must need to have a column with unique values first then using RANKX function you are able to create index.
It is always better to create index column in power query editor.
Hope this helps!!
If this solved your problem, please mark it as a solution!!
Basically Dax don't have any exact function to create index column. You must need to have a column with unique values first then using RANKX function you are able to create index.
It is always better to create index column in power query editor.
Hope this helps!!
If this solved your problem, please mark it as a solution!!