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: 
OS92
Contributor II
Contributor II

Month in number

Hello everyone,

have anybody a solution for my problem? 

I need a diagramm with month & year in the form mm/yyyy. As example 02/2021.

In my case, the month is a text and not a number. Is there any function to change the name into a number?

Unbenannt.JPG

 

Thanks.

 

 

3 Replies
Henri_Rufin
Luminary
Luminary

I suggest to create a mapping table you will use then in your model to turn your text into number. 

MONTH_MAPPING:

MAPPING LOAD * INLINE
[
MONTH_MAPPING-FROM,MONTH_MAPPING-TO
Jan,1
feb,2
mar,3
...

];

Then apply the following
Subfield(“Field”,’ / ‘,1)&” / “ &ApplyMap(‘MONTH_MAPPING’ , subfield(”Field”, ‘ / ‘ ,2)) as Field

Ksrinivasan
Specialist
Specialist

hi,

in dimension

 

=Num(Month(Dateoo))&'/'&Year(Dateoo)

 

ksrini

Vegar
MVP
MVP

If you have a date field then you can create this field by using date() formating function.

Date(monthname(DateField),'MM/YYYY') 

With this method you won't get the same issues getting the sorting correct as it will sort chronological and not alphabetical per default.