Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Nolgath
Creator
Creator

Order by Months is not quite working..

I have a bar graph simple one. With Months as columns/dimension and then measure it's the bought-cars.

Everything is ok with that, I am only having trouble with the month order. I had a pivot table and unpivoted it I might add.

I have this expression already to remove "Total" - =if(MONTH='Total',null(),[MONTH])

Then I have this script : 

[Bought Cars_temp_1f526754-2f84-f288-96dd-5724942f]:
LOAD
[KAMS] AS [Bought Cars.KAMS],
[bought_jan] AS [January],
[bought_feb] AS [February],
[bought_mar] AS [March],
[bought_apr] AS [April],
[bought_may] AS [May],
[bought_jun] AS [June],
[bought_jul] AS [July],
[bought_aug] AS [August],
[bought_sep] AS [September],
[bought_oct] AS [October],
[bought_nov] AS [November],
[bought_dec] AS [December],
[bought_2022] AS [Total]
RESIDENT [Bought Cars];
DROP TABLE [Bought Cars];

RENAME TABLE [Bought Cars_temp_1f526754-2f84-f288-96dd-5724942f] to [_temp_e9852b0a-7777-3dcf-ff91-2fc30c78];
[Bought Cars]:
CROSSTABLE ([MONTH],[bought-quantity],1)
LOAD
[Bought Cars.KAMS] AS [KAMS],
[January],
[February],
[March],
[April],
[May],
[June],
[July],
[August],
[September],
[October],
[November],
[December],
[Total]
RESIDENT [_temp_e9852b0a-7777-3dcf-ff91-2fc30c78]
;


DROP TABLE [_temp_e9852b0a-7777-3dcf-ff91-2fc30c78];

 

 

My goal is to make the months go from January to December in the columns, mine are alphabeticly, like "April" "August" "December" etc.. 

 

I tried Order by but can't seem to make it work..

Labels (3)
2 Solutions

Accepted Solutions
Or
MVP
MVP

'August' and 'July' are strings, so there's no way for Qlik to sort them "by month". You would need to convert them to a date format, apply a month number using e.g. Dual('January',1), or provide a custom sort order (most typically using Match(Month,'January','February' etc)

View solution in original post

Or
MVP
MVP

Looks like you've elected to sort your chart by Y value...

View solution in original post

6 Replies
Or
MVP
MVP

'August' and 'July' are strings, so there's no way for Qlik to sort them "by month". You would need to convert them to a date format, apply a month number using e.g. Dual('January',1), or provide a custom sort order (most typically using Match(Month,'January','February' etc)

Nolgath
Creator
Creator
Author

Thank you for the reply.

I did Dual([January],1) etc until December. It duplicated the months but still is ASC order alphabetical.

I understand the logic of that, but now I get duplicates which also makes sense.. 

Match would be user after Resident table?

Or
MVP
MVP

The Match() approach would be used as a custom sort order / by expression.

Note that you need to set your sort order if you don't want the default one, in the Sort pane.

Nolgath
Creator
Creator
Author

It still did not work. I get this : Image

Or
MVP
MVP

Looks like you've elected to sort your chart by Y value...

Nolgath
Creator
Creator
Author

Wow. I am amazed at myself and at this program. I just swapped the X with the Y in the sorting column and that insta fixed it. Thanks