Sort S M L XL tee-shirt sizes correctly

I have data about tee-shirt sizes, with values S, M, L, XL. When I put this data element on the X axis, my sort choices don’t support showing them is this specific order: S, M, L, XL.

I have worked in other systems where the values in a string field could have an order associated with them, so S < M < L < XL. How can I do this in QuickSight?

Hi @GeorgeReimonn and welcome the the QuickSight community!
Unfortunately, does not currently support a way to setup a ranking system based on letters to be used in a visual.
At AWS, our roadmap is primarily driven by our customers, your feedback helps us build a
better service. I will tag this as a feature request to provide visibility to our support team!

Hi @GeorgeReimonn -

You can use a calculated field and custom sort. Look at this answer to get an idea.

c_custom_sort

ifelse(
size='S',1,
size='M',2,
size='L',3,
size='XL',4,
0)

or

switch(size, 'S', 1, 'M', 2, 'L', 3, 'XL', 4, 0)
3 Likes

Hi @GeorgeReimonn,
It’s been awhile since we last heard from you so checking in to see if you had any additional questions?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

I was able to get this to work using two things:

  • A second column NSize which is a numerical version of shirt size
  • Use of “off visual field” option in sorting the X axis.

Size NSize Sold
S 1 10
M 2 12
L 3 5
XL 4 7

So I’m all set and you can close this item. --George

1 Like

So while I was able to move forward, there are competitors that allow the text and numeric nature of the data to be within a single column, so no need to manage the second column and keep things consistent. So you still might consider a future enhancement.