Forum Discussion

newpbiuser01's avatar
newpbiuser01
Helper V
4 years ago
Solved

Slicer Custom Sort

Hello,   I need to create a custom sort based for a slicer where the values are going to be all the fruits in the dataset and also an "All Fruits" option. I need to sort the column so the "All Frui...
  • johnt75's avatar
    4 years ago

    You could create a table which will add new values when they appear as

    New Table = 
    var fruits = VALUES('Table'[Fruit])
    return UNION( 
    ADDCOLUMNS( fruits, "Sort order", RANKX(fruits, [Fruit], , ASC),
    { ( "All fruits", -1) }
    )