Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nehapathak
Contributor II
Contributor II

how to extract month number from month name

I want to extract month number from name in expression(measure).

for example if month name is March it should return me 3. Kindly suggest me a function for that in qliksense.

9 Replies
Anil_Babu_Samineni

The format of Qlikview and Qliksense are similar. May be this?

Num(Month(FieldName)) as MonthNum

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Num(Month(Date#(MonthText,'MMM')))                  // If months are short names like, Jan, ...

Or,

Num(Month(Date#(MonthText,'MMMM')))             // if months are full names like, January, ....

avinashelite

The other way would be is to create a inline table for 12 month with the value and you could map that with number

tresesco
MVP
MVP

And if you have created the month field in the script using month() already, you could simply use num() to get number like:

Num(Month)

poojashribanger
Creator II
Creator II

Hi Neha,

You can use this expression

Mod(Month(DateField) - $(vFiscalYearStartMonth),12)+1

where vFiscalYearStartMonth is an variable in my case i have assigned it with 4 you can assign according to your requirement

prma7799
Master III
Master III

Like this???

Load

Date,

Num(Month(Date)) AS MonthNumber

....

puneetagarwal
Partner - Creator II
Partner - Creator II

Hi Tresesco,

I could retrieve month number from date column but i need both the numbers


Eg: "20190101" is my date format if I use num(month(fieldname)) , I am getting output as "1" but my requirement is "01"
how do i get that?

Thanks in advance

Regards,

Puneet

tresesco
MVP
MVP

If you need two-digit output, try using number formatting, like:

 

num(month(fieldname), '00')

puneetagarwal
Partner - Creator II
Partner - Creator II

Thanks Tresesco

I got the correct output.

Regards,
Puneet Agarwal