Interactive sorting by calculated column percentage

  • I am trying to add an interactive sort to a table using an expression that returns a percentage however the sorting is not in the desired order I am expecting and I have not been able to figure out why this is happening or how to resolve it. The values should sort high to low or in the reverse order rather than what it is shown below. My expression for sorting is as follows. (Fields!Labor_Sell.Value - Fields!Labor_Cost.Value) / Fields!Labor_Sell.Value

  • lucaskhall - Wednesday, August 23, 2017 11:29 AM

    I am trying to add an interactive sort to a table using an expression that returns a percentage however the sorting is not in the desired order I am expecting and I have not been able to figure out why this is happening or how to resolve it. The values should sort high to low or in the reverse order rather than what it is shown below. My expression for sorting is as follows. (Fields!Labor_Sell.Value - Fields!Labor_Cost.Value) / Fields!Labor_Sell.Value

    I know little of SSRS but it would appear that you're sorting on the display value (which is a string) rather than on the mathematical value.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • LAs Jeff zaid - your value is being sorted as text. You need to change the column data type to a percentage for that column.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

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

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