Sort by using a numeric field is random

Hi,

I’m trying to sort a bat graphs columns by weekday, the label is Text (days of week, Monday, Tuesday, etc.) but I have set the sort by to use a numeric day of week column (0,1,2, etc.)

SELECT
weekday, weekdayname
FROM dim_date
group by weekday, weekdayname;

0 Sunday
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday

However, the ordering of the visualisation is seemingly random:

If it makes any difference (It shouldn’t I would assume) all the tables (fact and dimensions) are in Redshift.

Is this a bug?

As I can’t put this in the 1st post, this is the image showing the sorting:

That should definitely work. Make sure you set the aggregation to Min (or Max) and not Sum, which is the default. I cant see that part in your screenshot so wasnt sure what you had that set to.

image