Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert month into Month name

Hi all!

i have months as numbers in excel file, how can i convert them to Month Names in qlikview

8 Replies
MK_QSL
MVP
MVP

Use below in your script

Subfield('$(MonthNames)',';',NumberFormatMonthField) as MonthName

its_anandrjs

Hi,

Map the another String Month

Map:

Mapping Load * inline

[

NumMonth,MonthName

1,Jan

2,Feb

3,Mar

4,Apr

5,May

6,June

7,July

8,Aug

9,Sep

10,Oct

11,Nov

12,Dec

];

Fact:

Load

ApplyMap ('Map', NumMonth,) as MonthName

From Source;

Regards

Anand

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or how about this (much simpler). Assume that the column with month number is called MNum:

LOAD *,

          text(Month('1/' & MNum & '/2014')) AS MonthName

FROM YourExcelFile.xlsx (...);

Month() always returns a dual value, and depending on the context it will use the numerical or string representation. Text() forces the use of the string representation.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Note that, just like Manish's example this solution will use the month names (or abbreviations) that are set at the beginning of your script.

If you prefer full month names or different languages, then use the Mapping Table solution as presented above by Anand.

Good luck,

Peter

its_anandrjs

Hi,

And more specific if you requires perfect monthname field then write like

Map:

Mapping

LOAD NumMonth,Month(Date#(MonthName,'MMM')) as MonthName;

Load * Inline

[

NumMonth,MonthName

1,Jan

2,Feb

3,Mar

4,Apr

5,May

6,June

7,July

8,Aug

9,Sep

10,Oct

11,Nov

12,Dec

];

Fact:

Load

ApplyMap ('Map', NumMonth,) as MonthName

From Source;

Regards

Anand

preminqlik
Specialist II
Specialist II

Load *,

Month(Date#(Monthnumberfield,'MM'))               as      Monthname

from xxx;       

Clever_Anjos
Employee
Employee

Use the special variable MonthNames to do this

SubField(MonthNames,';',5)  will return May

SubField(LongMonthNames,';',6) will return June

Anonymous
Not applicable
Author

Thanks everyone I have solved the problem by using Month(Date#(Monthnumberfield,'MM')) function