Riggun
Riggun

Reputation: 315

Power BI Add rank or row number to column

Im trying to add just a simple rank numbering or row number to column but no luck. I have a simple test table which consist of 2 columns - Name and Room number. I have attached Room Number to filter so it can be filtered. My goal is to add a number to resulted raws. Im using dax measure for this but no luck. This is my DAX measure code:

Visitor num = RANKX('myTab',CALCULATE(count('myTab'[Name])))

But it returns only 1 for each rowenter image description here

enter image description here

My PBIX file

Upvotes: 2

Views: 2449

Answers (1)

davidebacci
davidebacci

Reputation: 30289

Try changing the filter context:

Visitor num = RANKX(ALLSELECTED('myTab'),CALCULATE(MAX('myTab'[Name])))

enter image description here

Upvotes: 2

Related Questions