Discussion Board for collaboration related to QlikView App Development.
Hi all!
i have months as numbers in excel file, how can i convert them to Month Names in qlikview
Use below in your script
Subfield('$(MonthNames)',';',NumberFormatMonthField) as MonthName
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
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.
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
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
Load *,
Month(Date#(Monthnumberfield,'MM')) as Monthname
from xxx;
Use the special variable MonthNames to do this
SubField(MonthNames,';',5) will return May
SubField(LongMonthNames,';',6) will return June
Thanks everyone I have solved the problem by using Month(Date#(Monthnumberfield,'MM')) function