Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

make number to month name

Hi,

does anyone now if I can create out of a number a month name??

example:

8 -> Aug

9 -> Sep

please help me

regards,

MT

10 Replies
Highlighted
Master
Master

Re: make number to month name

Hi MT,

Did you try this threads yet?

http://community.qlik.com/message/224231

http://community.qlik.com/thread/49830

Regards,

Sokkorn

Highlighted
MVP
MVP

Re: make number to month name

Hi

Or (assuming MonthNum contains a number such as 8 for Aug

Month(MakeDate(2000, MonthNum, 1)) As Month

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Highlighted
Partner
Partner

Re: make number to month name

Try this

FOR i=1 to 12

LOAD Month(MakeDate(Year(Today()),$(i),1)) as Month AutoGenerate(1);

NEXT

FOR i=1 to 31

LOAD $(i) as Day AutoGenerate(1);

NEXT

You can also concatenate the Month or Day field with your original table month & day fileds. By using Concatenate(Table1) Load ...

Cheers!

Jagan

Highlighted
Not applicable

Re: make number to month name

In your QV script, you can set your Month Names like this...

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

based on which, you can call them in your script below as ... Month(xyz) as "Month Name"

Highlighted
Not applicable

Re: make number to month name

 

Month

(MakeDate(year(Year,MonthNo))

Highlighted

Re: make number to month name

In your fact table or where you have field MonthNum use Mapping table and map the Monthname in the table See the load script

MapTable:

Mapping LOAD * INLINE [

     MonthNum, MonthName

     1, Jan

     2, Feb

     3, Mar

     4, Apr

     5, May

     6, Jun

     7, Jul

     8, Aug

     9, Sep

     10, Oct

     11, Nov

     12, Dec

];

FactTable:

LOAD *, ApplyMap('MapTable',MonthNum) as MonthName  Inline [

MonthNum

1

2

3

4

5

6

7

8

9

10

11

12

];

Or

FactTable:

LOAD

*, ApplyMap('MapTable',MonthNum) as MonName

From Location;

Highlighted
MVP & Luminary
MVP & Luminary

Re: make number to month name

Hi,

Try like this

LOAD

*,

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

From DataSource;

Regards,

Jagan.

Highlighted

Re: make number to month name

After load a table as mapping table then if you have problem to get the correct monthname then try to load your map table differently see the load script

MapTable:

Mapping LOAD

RowNo() as MonthNum,

Month(AddMonths((Today()),RowNo()+7)) as MonName

AutoGenerate 12;

FactTable:

LOAD *, ApplyMap('MapTable',MonthNum) as MonthName

Inline [

MonthNum

1

2

3

4

5

6

7

8

9

10

11

12

];

Regards

Anand

Highlighted
Specialist II
Specialist II

Re: make number to month name

hi try this

Load *,

month(Date#(field,'M'))               as               Monthname

from path;