# Question - Sorting by a specified order that is neither Z to A, or A to Z -- is this possible and how?

### Question

• I need records sorted in a specified order using a text field where A to Z or Z to A won't work.  An example would be Orange, Banana, Cherry.  How do I make it happen?
Thursday, January 23, 2014 6:08 PM

• You would need to add a sort order field and then order by that field.

Thursday, January 23, 2014 8:57 PM
• Hi OceanDr,

Based on your description, you want to Sorting by a specified order, neither A to Z nor Z to A. If in this scenario, we can try to add a calculated field to convert the values of the field to a, b, c, d… depend on the specified order. Then Sorting the field by A to Z to achieve your requirement. For more details, please refer to the following steps:

1. Right-click the dataset to add a calculated field named Order with the expression like below:
=switch(Fields!LineCode.Value="Orange","A",Fields!LineCode.Value="Banana","B",Fields!LineCode.Value="Cherry","C")
2. Right-click the report item to open the properties dialog box.
3. Click Sorting in the left pane, then add a sorting as below:
Sort by: [Order]                                                                   Order: A to Z

If you have any other questions, please feel free to let me know.

Thanks,
Katherine Xiong

Katherine Xiong
TechNet Community Support

Friday, January 24, 2014 7:44 AM

### All replies

• You would need to add a sort order field and then order by that field.

Thursday, January 23, 2014 8:57 PM
• Hi OceanDr,

Based on your description, you want to Sorting by a specified order, neither A to Z nor Z to A. If in this scenario, we can try to add a calculated field to convert the values of the field to a, b, c, d… depend on the specified order. Then Sorting the field by A to Z to achieve your requirement. For more details, please refer to the following steps:

1. Right-click the dataset to add a calculated field named Order with the expression like below:
=switch(Fields!LineCode.Value="Orange","A",Fields!LineCode.Value="Banana","B",Fields!LineCode.Value="Cherry","C")
2. Right-click the report item to open the properties dialog box.
3. Click Sorting in the left pane, then add a sorting as below:
Sort by: [Order]                                                                   Order: A to Z

If you have any other questions, please feel free to let me know.

Thanks,
Katherine Xiong

Katherine Xiong
TechNet Community Support

Friday, January 24, 2014 7:44 AM