SSRS 2016 Custom sort switch expression in grouping

  • Please help to custom sort the return in this order(Strategic Shift,1,Day case,2, Same day EC,3, Elective,4, Emergency,5, Non-Elective,6) .

    =Switch(

    Fields!site like "ILK*", "Strategic Shift",

    Fields!Reason.Value="MAUT","Same Day EC",

    Fields!Reason.Value="CUB","Same Day EC",

    Fields!Reason.Value= "HOTC","Same Day EC",

    Fields!Reason.Value = "NELACC","Same Day EC",

    Fields!Type.Value= "EL","Elective",

    Fields!Type.Value= "DC","Day cases",

    Fields!Code.Value = "31","Non-Elective",

    Fields!Code.Value = "32","Non-Elective",

    Fields!Code.Value = "81","Non-Elective",

    Fields!Code.Value = "82","Non-Elective",

    Fields!Code.Value = "83","Non-Elective",

    True, "Emergency")

     

    many thanks for your help

  • What if you create a dataset of (Strategic Shift,1)(Day case,2), (Same day EC,3), (Elective,4), (Emergency,5), (Non-Elective,6) and then sort by that? (Maybe you need to create a calculated column in your existing dataset and look up the numeric value to sort on.

    (it would be a lot easier to help if you provided some data... even fake data!)

    • This reply was modified 5 years, 9 months ago by pietlinden.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply