Another couple of method that may give you better performance is to solve this in the script.
Method 1 is to generate a field in the script for the sort order. Create a field in either the same table as the TRN_YM field, or a separate linking table which has the TRN_YM and TRN_YM_SortOrder fields, where TRN_YM_SortOrder is an integer representing the sort order. You could even have a 3rd field (TRN_YM_Required) which contains the IF statement above so it only contains the required limited months. Then in the chart you can use the TRN_YM_Required field as the dimension, and the TRN_YM_SortOrder as the Sort expression.
Method 2 is to load the TRN_YM field into a temporary table in the order you want it presented, even if you have to hard code them in the specific order. This needs to be done before you load the field anywhere else in the script. You can then drop the table later, but this will then allow you to sort by Load Order.