Forum Discussion

Brotedo's avatar
Brotedo
Helper I
4 years ago
Solved

Custom Sort for Matrix Column - Alphabetical but Move 1 Entry to End

I have a table with multiple entries, and I need a custom sort that keeps the alphabetical order, but always moves 'Other' to the end. So this: Data Apple Banana Orange Other P...
  • tamerj1's avatar
    4 years ago

    Hi Brotedo 
    Here is a sample file with the solution https://www.dropbox.com/t/UlPm1CBMkhWfRtnZ 

    Rank Measure = 
    VAR SelectedData = ALLSELECTED ( Table1[Data] )
    VAR CurrentData = SELECTEDVALUE ( Table1[Data] )
    RETURN
        IF ( 
            CurrentData = "Other", 
            COUNTROWS ( SelectedData ) + 1,
            RANKX ( 
                SelectedData, 
                CALCULATE ( SELECTEDVALUE ( Table1[Data] ) ),, 
                ASC, 
                Dense 
            )
        )