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

How can I convert numbers to months (i.e. 1 = January)

Hello,

New to Qlikview... please can someone tell me how I can convert numbers to months to that 1 is displayed as Jan, 2 as Feb etc. I have a listbox with the numbers 1 - 12 in - so how can I convert the numbers to text and still retain the functionality?

Thanks,

markp3rry.

14 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

LOAD

*,

Pick(monthnum, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') AS Month

FROM Data;


Regards,

Jagan.

Not applicable
Author

Date# is how Qlikview knows what "1" or "2" means... Then use the "Month" function around it. No hard coding years needed.

Month(Date#([FIELD],'M')) as MONTH

ramasaisaksoft

Hi Mark,

if script like below

load * inline [

Mon

1

2

3

4

5

6

7

8

9

10

11

12

];

then simply  write the expression like below

=if(Mon=1,'Jan',

if(Mon=2,'Feb'))  up to  12 months

ramya_grandhi
Contributor III
Contributor III

Hi pratyush,

I have used the above script but I am not getting the Month names in order like jan, feb, mar...
i am getting in alphabetical order like apr, aug, dec, feb....

Can you please suggest me how can I get that in this order. jan, feb, mar...


I should not add inline table

Thanks in Advance

hic
Former Employee
Former Employee

You need to create dual values. The simplest way is to use

Month(MakeDate(2018,Month))

but you can also modify Pratyush' script to

=if(Month=1,Dual('jan',1),

        if(Month=2,Dual('Feb',2),

              if(Month=3,Dual('March',3)

              ...

HIC