@ed727 I believe you are right. @stuart.warren1 my suggestion was geared to enable you to use the result of that expression in a viable way where possible in your app. It was “trapped” inside the text element. Now it is not.
To sort the RG you will likely need to store that value in a number field of the RG’s data source thing.
Or pre calculate it prior to displaying it in the rg.