Forum Discussion
Row Number
- 2 years ago
Hey JofrainVisda ,
I think you can achieve this if you are able to add a column to your table that acts as a ro identifier:
Then you can add the below DAX to create the column you are looking for:
Column = ROWNUMBER( SUMMARIZE( ALLSELECTED( 'Table') , 'Table'[item] , 'Table'[rowindex] ) , ORDERBY( 'Table'[rowindex]) , DEFAULT , PARTITIONBY( 'Table'[item] ) )RANKX will not work because of
- you have to partition by the single occurences and
- you have to consider the ties, RANKX will never provide consecutive numbers for the same value.
Hopefully, this helps to tackle your challenge.
Regards,
Tom
Yes, you can achieve this using DAX (Data Analysis Expressions) in Power BI or other tools that support DAX. You can use the RANKX function to assign a row number to each occurrence of values in Column 1. Here's a sample DAX expression you can use:
Row Number =
RANKX(
ALL('YourTableName'[Column1]), // Replace 'YourTableName' with the name of your table and 'Column1' with the name of your column
'YourTableName'[Column1], // Replace 'YourTableName' with the name of your table and 'Column1' with the name of your column
, ,
ASC,
Dense
)
This DAX expression will generate a row number for each occurrence of values in 'Column1'. Replace 'YourTableName' with the actual name of your table and 'Column1' with the name of your column.
You can add this DAX expression as a new calculated column in your Power BI table or use it in a measure, depending on your requirements.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.