Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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 ReportingMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
204 | |
86 | |
62 | |
59 | |
56 |