Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Real Long Month Names, sorted by number of month, not alphabetical order

Hi all,

I'a aware that this is a well documented topic. However, I haven't found the answer to the solution I need for a Master Calendar. I have set the formats as follows:

SET MonthNames='Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez';

SET DayNames='Mo;Di;Mi;Do;Fr;Sa;So';

SET LongMonthNames='Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember';

SET LongDayNames='Montag;Dienstag;Mittwoch;Donnerstag;Freitag;Samstag;Sonntag';

LET vTempDate = Today();

Then I generate a temporal table with daily dates, based on the variable vTempDate. Then I reload this temporal table and calculate all kind of "handles" to be used later with the GUI. Part of the script is as follows

...

WeekDay (vTempDate) as Wochentag,

date(vTempDate,'WWWW') as WochentagLang,

Week(vTempDate) as Woche,

num(Month(vTempDate)) as Monat,

month(date(vTempDate, 'MMMM')) as MonatLong,

month(vTempDate) as Monat_Name,

....

Now, the handle I'm still missing is MonatLong. That should read Januar, Februar, März, etc. with the underlying number of the month for sorting in the correct manner. However, all I have achieved so far, is that MonatLong comes out as Jan, Feb, Mrz,....

I also tried to generate  long month names using

if(num(Month(vTempDate)) = 1,'Januar',if(num(Month(vTempDate))=2,'Februar',if(num(Month(vTempDate))=3,'März',if(...

or

Date#(date(vTempDate, 'MMMM')) as MonatLong,

But then the correct sorting order (according to number of Month) is lost and MonatLong just sorts in an alphabetical order.

Anyone any ideas?  Thanx and kind regards

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

Dual(date(vTempDate, 'MMMM'),Month(vTempDate) ) as MonatLong,

View solution in original post

8 Replies
swuehl
MVP
MVP

Try

Dual(date(vTempDate, 'MMMM'),Month(vTempDate) ) as MonatLong,

sunny_talwar

Try this for MonthLong and it should sort without any other modification by sorting it by numeric ascending:

Date(MonthStart(vTempDate), 'MMMM') as MonatLong,

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

If I understand your requirement, you need long month name..

If that is write then all you need to do is change the value of variable Monthname as below.

SET MonthNames='Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember';


Same with Day Name.


and then use normal function month(Date) to get the long month name.


Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
swuehl
MVP
MVP

Hi Sunny,

I think that will create multiple distinct values for a given Month over years.

sunny_talwar

Hmmm, that is a very good point

Peter_Cammaert
Partner - Champion III
Partner - Champion III

In the following script line:

:

month(date(vTempDate, 'MMMM')) as MonatLong,

:

remove the Month() function call. Month will reset the format back to short month names. Date on its own will do the trick, like:

:

date(vTempDate, 'MMMM') as MonatLong,

:


Of course, since the underlying value will still be a date, your long month name will appear for every different date value (and every month name will appear many times in a list box). If you want to avoid that, use MonthStart to pre-format the date value, as Sunny suggested.


Peter


Not applicable
Author

Hi Sunny Ti

You're solution worked too! 🙂

sunny_talwar

Great