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
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
Thank you Tom! Your solution worked. I will accept this as the solutions.
Could I also add a parameter in this solution? like if I have a column 2 and it has a value of 1 and 2. So what I want to add is to count the sequence of Column 1 who's Column 2 is equal to 1. Then another sequence for Column 2 is equal to 2.
- TomMartens2 years agoSuper User
Hey JofrainVisda ,
I have to admit that I have no idea what your requirement is and please open a thread.
Regards,
Tom