Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
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

11 Replies
Sokkorn
Master
Master

Hi MT,

Did you try this threads yet?

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

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

Regards,

Sokkorn

jonathandienst
Partner - Champion III
Partner - Champion III

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
jagannalla
Partner - Specialist III
Partner - Specialist III

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

Not applicable
Author

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"

Not applicable
Author

 

Month

(MakeDate(year(Year,MonthNo))

its_anandrjs

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;

jagan
Luminary Alumni
Luminary Alumni

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.

its_anandrjs

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

preminqlik
Specialist II
Specialist II

hi try this

Load *,

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

from path;