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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month from a string

Hi Everyone,

I have a string field in the following format:

January

February

March

...

etc

I want to tell QV that it's months... Any idea how I do that?

Thanks

Gareth

1 Solution

Accepted Solutions
Not applicable
Author

I managed to do it with the following code:

MONTH(date#(MONTH, 'MMMM')) AS MONTH

MMMM tells QV that the string is a long month name format.  The original field is definitely a string, not a date/time.

View solution in original post

4 Replies
Not applicable
Author

Hi,

The first three characters are the monthname's in QV.

So, do something like this:

num(left(month,3),'00') and then you have the monthnum's in QV.

Succes,

Halmar

sridhar240784
Creator III
Creator III

Hi,

You use inline wizard to do this.

Load * Inline [

Month,Monthno

January,1

February,2

March,4

....

...

];

You can use this Month field to map to your transaction field.

if you have Date field with format 10-January-2011.

You can extract the month using below code.

=Num(Month(Date(Date#(Date,'DD-MMMM-YYYY'))),'00')

Hope this helps.

-Sridhar

Sokkorn
Master
Master

Hi Gareth,

Can you attached your sample data source more than two field (include month field)? I want to know that the field that store your month is a DateTime or String field.

Regards,

Sokkorn Cheav

Not applicable
Author

I managed to do it with the following code:

MONTH(date#(MONTH, 'MMMM')) AS MONTH

MMMM tells QV that the string is a long month name format.  The original field is definitely a string, not a date/time.