Normally you should be able to sort based on an association, but you can only do that with certain types of associations. If you are unable to change this, you can do the following:
What you could do is use a _Helper attribute. You do this by de-normalizing your domain model, which means that you store the exact same attribute with the same information in two different entities.
While this may feel a bit odd, these are acceptable ways to work around the limitations of the platform. If you make sure that the _Helper attribute is well managed and always has the correct value, then there is nothing to worry about.
By the way, I call this attribute “_Helper” (notice the underscore) because it is used as a "technical" attribute which in this entity is not displayed to the end user. It is then a best practice to start with an underscore so that all developers are aware of this. As written in Mendix's best practices document: https://docs.mendix.com/howto/general/dev-best-practices#3-2-2-entity-attributes