Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

MVP
MVP

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

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

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

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

Highlighted
ramasaisaksoft
Valued Contributor III

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

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
New Contributor

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

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

Employee
Employee

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

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

Community Browser