Forum Discussion
vanvir
3 years agoNew Member
DAX - Rank duplicates in sequence
Hi experts group, I have searched the forum, but can't find the solution on my issue. I need your help to write DAX code on how to rank the duplicates in sequence. This is the data and I'd like to ...
- 3 years ago
Hi vanvir for possible solution, please create two columns, Index and Count Formula.
Index column should be created by Power Query, choose From 1.
Second column, Count Formula is calculated column with formula below. Output is same as yours.
Did I answer your question? Kudos appreciated / accept solution!
Link for how to do it below
Count Formula =VAR __currentvalue=Sheet1[Type]VAR __current_index=Sheet1[Index]VAR _count_filtering=CALCULATE(COUNTROWS(FILTER(Sheet1,Sheet1[Type]=__currentvalue)),ALLEXCEPT(Sheet1, Sheet1[Type]),Sheet1[Index]<=__current_index)VAR _Result=_count_filtering-1 --forcing to count 0 (alternative change Index to 0)RETURN _ResultOutput
some_bih
Community Champion
3 years agoHi vanvir for possible solution, please create two columns, Index and Count Formula.
Index column should be created by Power Query, choose From 1.
Second column, Count Formula is calculated column with formula below. Output is same as yours.
Did I answer your question? Kudos appreciated / accept solution!
Link for how to do it below
Count Formula =
VAR __currentvalue=Sheet1[Type]
VAR __current_index=Sheet1[Index]
VAR _count_filtering=
CALCULATE(
COUNTROWS(
FILTER(
Sheet1,
Sheet1[Type]=__currentvalue
)
),
ALLEXCEPT(Sheet1, Sheet1[Type]),
Sheet1[Index]<=__current_index
)
VAR _Result=
_count_filtering-1 --forcing to count 0 (alternative change Index to 0)
RETURN _Result
Output