Forum Discussion

XYZ24's avatar
XYZ24
New Member
3 years ago

Appreciate help with change sorting order

Hi All, I need help in change the sort order of term short to 3 ,medium to 2 and long to 1. Any help is appreciated .Thanks

 

1 Reply

  • hi   

    Try this:

    = SWITCH ( selectedvalue, data[Term], "Short", 1, "Medium", 2, "Long", 3 )

    But if you're going to sort the Term column  by this newly created calculated column,  you'll likely end up with a cyclic reference error. When that happens, create another calculated column, say Term2, which simply refers to the original Term column ( = Data[Term] ), sort it by the newly created sort column and use that instead of the original Term column. Alternatively, you can create a custom column in Power Query with a similar logic.

     
     

     

    
    

     

    XYZ24