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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort months by name

hello, I have a calculated field that returns the name of the month.
I would like to enter this field in a table and sort by name month (in Italian).
I'm applying the function

dual ([Date planned delivery], if ([Date planned delivery] = 'Gennaio', - 1, num ([Date planned delivery])))

but it does not work.
I also applied to the expression:

= Match ([Date planned delivery], $ (= chr (39) & Replace (MonthNames, ';', chr (39) & ',' & chr (39)) & chr (39)))

but even this works correctly.

Does anyone have any idea what it should use?

8 Replies
sunny_talwar

Would you be able to share a sample?

Not applicable
Author

If I use the expression the result is:

and its' wrong.

The correct result is:

Gennaio (January)

Marzo (March)

Aprile (April)

Maggio (May

Giugno (June)

sunny_talwar

Can you try this as your calculated dimension:

Date(Date#(Upper(MonthFieldName), 'MMMM'), 'MMMM')

or

Month(Date#(Upper(MonthFieldName), 'MMM'))

Not applicable
Author

The result is not correct. If I use your formula the result is:

But I would that the order is:

gennaio (Jenuary)

marzo (March)

aprile (April)

maggio (May)

giugno (June)

luglio

agosto

settembre

ottobre

novembre

dicembre

sunny_talwar

Can you share your environmental variables from the script?

They would look something like this

Capture.PNG

Not applicable
Author

SET ThousandSep='.';

SET DecimalSep=',';

SET MoneyThousandSep='.';

SET MoneyDecimalSep=',';

SET MoneyFormat='€ #.##0,00;-€ #.##0,00';

SET TimeFormat='hh:mm:ss';

SET DateFormat='DD/MM/YYYY';

SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';

SET MonthNames='gen;feb;mar;apr;mag;giu;lug;ago;set;ott;nov;dic';

SET DayNames='lun;mar;mer;gio;ven;sab;dom';

sunny_talwar

Add one more to the list:

SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

But change the month names to your Month Names

gennaio (Jenuary)

marzo (March)

aprile (April)

maggio (May)

giugno (June)

luglio

agosto

settembre

ottobre

novembre

dicembre

Once this is done try this once again -> Date(Date#(MonthFieldName, 'MMMM'), 'MMMM')

tamilarasu
Champion
Champion

You can use sort expression like below,

=Date(Date#(Left(FieldName,3),'MMM'),'MMM')

Untitled.png