Sort Function in SSRS by numeric order

  • Hi All,

    I need help in writing Sorting function. I am running a report in SSRS 2008. This report is a bar chart report. X-axis values are 7A, 6A, 5A,4A,3A,2A,A,B,C......O. But in report on x-axis I am getting them in this order 2A,3A,4A,5A,6A,7A,A,B.....O. I need to sort them in this order: 7A, 6A, 5A,4A,3A,2A,A,B,C......O.

    Just FYI:

    I am following this process to add sorting on x-axis:

    1. Right-click a field in the Category Field drop-zone and click Category GroupProperties.

    2. In the Category Group Properties dialog box, click Sorting.

    3. For each sort expression, follow these steps:

    a. Click Add.

    b. Select the expression that matches your grouping field. You can verify the expression for the grouping field by clicking Grouping.

    c. From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending alphabetical order. Z-A sorts the expression in descending alphabetical order.

    4. Click OK.

    Please suggest me sorting function or any other way to achieve this.

    Thanks,

    Robin

  • If it was me, I would probably add a little logic to the query producing the data that orders the values the way you would like (ie adds a field called sort_order that gets a value of 0 for 7A, 1 for 6A, 2 for 5A, etc). Then the sort_order field is what you order by.

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

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