Sorting Pivot Table Columns - Unable to Sort by Query Field

Hi everyone

I have a dataset that I am building a pivot table over. I have a field containing a text value that will become the column headings when added to the pivot table. I would like to sort these columns left to right in a specific order and not just alphabetically by their text. So in my underlying query I built a numeric column that I was hoping to use to sort the columns by. It contains a value determined by a data pattern, but ends up like 101, 201, 302, 507, etc.

I built the pivot table and added the field containing the text names to the column field well. I then choose to sort by an off-visual field, select my numeric sort order field that I created, and hit Apply. However this isn’t working - the columns remain sorted alphabetically by their name and not by the numeric column.

What am I doing wrong here? I cannot work out why the columns can’t be sorted by the numeric field from my dataset. I wanted to try and create a query that I can re-use in other datasets based on other data sources, where the column headings will be different.

I’ve found a workaround for this so thought I’d update, in case anyone else tries to do the same thing. Basically, if I add my sort order field to the columns well as the FIRST field, I can then apply the sorting to it and it seems to take precedence over the natural alphabetised sort order of the actual column names. I then hid the sort order field so it wasn’t shown, and that left my desired columns in the correct order.

Hope this might be of some help

1 Like