sorting to show only few values at the start of the column

  • hi,
    How can we show only few values in the column at the top. Attached is the picture , I want to show the three at the top of column and rest in "ascending order".

    Is there an expression we can do it? and how?

  • ORDER BY
        CASE
            WHEN [Group] IN ('Pres','Succ','Total') THEN 0
            ELSE 1
        END
    ,    [Group]

    Edit - oooh, this is an SSRS question.  Sorry.  There must be a way of doing something like the above in the expression language.

    John

  • Do you mean you want to Display "Presentation Layer Loaded", "SuccessfullyLoaded" and "Total Scrape" first, and then the rest? What is your defining order for these, is it "Presentation Layer Loaded", "SuccessfullyLoaded" and then "Total Scrape", followed by the remainder in alphabetical order? If , you could do this in your SQL query easily enough with:
    ORDER BY CASE [GROUP] WHEN 'Presentation Layer Loaded' THEN 1
                          WHEN 'SuccessfullyLoaded' THEN 2
                          WHEN 'Total Scrape' THEN 3
                          ELSE 4 END ASC,
             [GROUP] ASC

    If you don't want to do this in your SQL, you shgould be able to easily use to and convert it to an Expression for your first order clause, and then set a second order on [Group].

    EDIT:
    SSRS Expression for first order Clause:
    =IIF(Fields!Group.Value = "Presentation Layer Loaded", 1, IIF(Fields!Group.Value = "SuccessfullyLoaded", 2, IIF(Fields!Group.Value = "Total Scrape", 3,4)))

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A - Thursday, March 9, 2017 9:57 AM

    Do you mean you want to Display "Presentation Layer Loaded", "SuccessfullyLoaded" and "Total Scrape" first, and then the rest? What is your defining order for these, is it "Presentation Layer Loaded", "SuccessfullyLoaded" and then "Total Scrape", followed by the remainder in alphabetical order? If , you could do this in your SQL query easily enough with:
    ORDER BY CASE [GROUP] WHEN 'Presentation Layer Loaded' THEN 1
                          WHEN 'SuccessfullyLoaded' THEN 2
                          WHEN 'Total Scrape' THEN 3
                          ELSE 4 END ASC,
             [GROUP] ASC

    If you don't want to do this in your SQL, you shgould be able to easily use to and convert it to an Expression for your first order clause, and then set a second order on [Group].

    Thanks every one who replies. It worked 🙂

Viewing 4 posts - 1 through 3 (of 3 total)

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