Sorting order of a text column in a question with grouping in form of a pivot table

Hello!
There’s a question in our Metabase that shows count of records with grouping by two columns in form of a pivot table (screenshot 1).


A column ‘TrafficSource’ has a few field values, starting with a number such as ‘1.YandexDirect’, ‘2.GoogleAds’, ‘3.Facebook’, ​’4.Instagram’. When I get results of the question without any sorting, values of TrafficSource above are sorted in the right order for a text column, values strarting with numbers go first. However, when I add sorting by the second column ‘Acquisition Week’ (numeric format, week of year), a sorting order by the column TrafficSource above seems to become randomize (screenshot 2).

When I use sorting in another question like that, where a second column is a text concatenation of year and month, a sorting order of TrafficSource doesn’t change (screenshot 3).

What can I do to fix the sorting order in the first question? Should I create a bug?

Hi @Marie
You are using a very old version of Metabase (probably 2 year old at least) - latest release is 0.38.2: https://github.com/metabase/metabase/releases

If you want to order by multiple fields, then add the other field to order by too, so you first group by “Acquisition Week”, then by “Traffic Source”.

Thank you!
Well, I meant the order of values in the headline in the pivot table that based on the column ‘TrafficSource’.
I added ‘TrafficSource’ to sorting, tried to change the column places in grouping, but it didn’t help.



There’re screenshots 4 and 5. On the screenshot 4 a field value starting with ‘3.’ (‘3.Facebook’) is first, but according to logic of text columns a field value starting with ‘1.’ (‘1.YandexDirect’) should be first, not ‘3.’ (‘3.Facebook’). And so on. The same is on the screenshot 5.
An example of the right order in the headline in the pivot table is on the screenshot 3. Our Metabase version is v0.32.5. Is there any desicion for that case without updating?

@Marie There are many improvements in newer versions - including advanced Pivot Table in 0.38.
I think you might be looking for this:
https://github.com/metabase/metabase/issues/9805 - upvote by clicking :+1: on the first post
But I cannot reproduce locally, so it’s hard to say if the problem you’re having is fixed in newer version.