Correct me if I'm wrong, but I think what you want to do is retrieve some data using a!queryprocessanalytics(), use an ID in a column of that data to retrieve the relevant text value from a reference table, and then sort the whole dataset using the text…