user18884753
user18884753

Reputation: 13

Adding an index column for a table with one column

I have a table named "Colors" in power BI with only one column

Color

Red Green Blue Cyan Grey Etc.

I need to add an index column with DAX that begins from 1 for the first row, 2 for the second row, 3 for the third row,....

I tried to use GENERATESERIES but it results in a table for each cell which is not what i want because i only need 1,2,3,... scalar values that correspond to each row

I also do not want to use power query

I would be grateful if you help

Best Regards

Upvotes: 0

Views: 705

Answers (2)

Ashok Anumula
Ashok Anumula

Reputation: 1515

First calculate a measure

Measure = MAX('Table'[Color])

Then calculate Rankx measure

Index = RANKX(ALL('Table'), [Measure])

enter image description here

Upvotes: 0

Pieter
Pieter

Reputation: 724

Okay, that's weird. Why not use PowerQuery? That's the ideal way to do it. Please explain your rationale for removing options.

Upvotes: 0

Related Questions