Personally, I would create the buckets for your Dimension in the Load and get them out of the app. Just more efficient.
Second, I would then put an inline table in that contains the values for the Diminsion and a value that will sort them in the order that you want.
In your visualization you would reference the field in your inline table instead. Just make sure that the field names match between the inline table and your other data.
This way you don't have all of these complicated nested Ifs in the app.