Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Dear community:
I need your support. I want to perform an equivalency of the SQL ROW_NUMBER function on one of my tables in Power BI; basically, do what I put in the image. This equivalence should be as a column and not a measure.
Thanks for your support!
Cheers,
Solved! Go to Solution.
Hi @DanCasSan ,
You can add an index column in query editor first.
Then use the rankx function to create the calculated column.
Rank =
RANKX (
FILTER (
'Table',
'Table'[KEYRATE] = EARLIER ( 'Table'[KEYRATE] )
&& 'Table'[PRDLIT] = EARLIER ( 'Table'[PRDLIT] )
),
'Table'[Index],
,
ASC
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DanCasSan ,
You can add an index column in query editor first.
Then use the rankx function to create the calculated column.
Rank =
RANKX (
FILTER (
'Table',
'Table'[KEYRATE] = EARLIER ( 'Table'[KEYRATE] )
&& 'Table'[PRDLIT] = EARLIER ( 'Table'[PRDLIT] )
),
'Table'[Index],
,
ASC
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@DanCasSan
For Rank Refer these links
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-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
Refer Rank by sub Category both in 1 and 2 article and use dense option in the last argument of RankX You have also use breaking ties option
I'm not aware of a way to put an index in a column in DAX. without a unique value to sort on. In Power Query, you just use the Add Column ribbon, then Index Column.
if you can rank your data and create an index that way, see this post
The problem is your data doesn't have a unique field, and row numbers aren't really a concept in a DAX table like they can be in SQL or Power Query.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCheck out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!