Forum Discussion
JofrainVisda
2 years agoAdvocate I
Row Number
Hi Friends, I would like to achieve this. Is this possible with DAX? I would like to put a row number for each occurence of the column 1. Thank you in advance!
- 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
JofrainVisda
2 years agoAdvocate I
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.
TomMartens
2 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