Forum Discussion
DAX query to create index based on two column
Need some DAX code to build a new Index column, as the screenshot is shown, I need to use the column "A" and "B' to build the new one column(Index).
Thanks in advance for your help.
| A | B | Index |
| 1 | ABC | 1 |
| 1 | DEF | 2 |
| 1 | DEF | 2 |
| 2 | ABC | 3 |
| 2 | DEF | 4 |
| 2 | DEF | 4 |
| 2 | WEF | 5 |
Hi Anonymous ,
Try this new column:
Index = RANKX('Table', [A] & [B],, ASC,Dense)
2 Replies
- camargos88
Community Champion
Hi Anonymous ,
Try this new column:
Index = RANKX('Table', [A] & [B],, ASC,Dense) - amitchandak
Super User
Anonymous , One is you add index column
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Better looking at data is rank
Rank = RANKX(ALL(Sheet1),[A]&[B],,ASC,Dense)For Rank Refer these links
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
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415