Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sarithaallot
Contributor III
Contributor III

convert numbers to yearmonth in qliksesne

Hi Team,

I have fields like 

43101431324316043191

 

I have to convert this numbers to 43101 to Jan-2018,43132 to Feb-2018,43160 to Mar-2018,43191 to Apr-2018....

This is my code

CrossTable(MonthSales,Sales,3)
LOAD
MKT,
BRAND,
MICR,
"43101",
"43132",
"43160",
"43191",
"43221",
"43252",
"43282",
"43313",
"43344",
"43374",
"43405",
"43435"

This is my data.I have used cross table function.After loading data it looksScreenshot (33).png Thanks

 

1 Solution

Accepted Solutions
SumitaKumari
Partner - Contributor II
Partner - Contributor II

Hi,

Please use combination of Date and Num# to get expected value  in load statement :

LOAD Date(Num#(YOURFIELD),'MMM-YY') as yearmonth
FROM DataSource;

View solution in original post

6 Replies
Ezir
Creator II
Creator II

Hi @sarithaallot .

 

Try

 

=DATE(43101,'MMM-YYYY')

Ezir
Creator II
Creator II

Your code would look like this:

CrossTable(MonthSales,Sales,3)
LOAD
MKT,
BRAND,
MICR,
DATE(43101,'MMM-YYYY'),
DATE(43132,'MMM-YYYY'),
DATE(43160,'MMM-YYYY')
...
SumitaKumari
Partner - Contributor II
Partner - Contributor II

Hi,

Please use combination of Date and Num# to get expected value  in load statement :

LOAD Date(Num#(YOURFIELD),'MMM-YY') as yearmonth
FROM DataSource;

Vegar
MVP
MVP

Try something like this:

PRE:

CrossTable(MonthSales,Sales,3)
LOAD
MKT,
BRAND,
MICR,
"43101",
"43132",
"43160",
"43191",
"43221",
"43252",
"43282",
"43313",
"43344",
"43374",
"43405",
"43435"

FROM SOURCE;

 

DATA:

NoConcatenate LOAD

MKT,
BRAND,
MICR, 

DATE(MonthSales, 'MMM-YYYY') AS YearMonth,

Sales

RESIDENT PRE;

DROP TABLE PRE;

 

(Sorry about the bad formatting of the code, I'm typing on my mobile device)

menta
Partner - Creator II
Partner - Creator II

You can use the function Monthname(Date)
sarithaallot
Contributor III
Contributor III
Author

Thanks Sumitha kumari.It is working for me.