Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to convert [2003.000000] in year

how to convert [2003.000000] in year 2003

14 Replies
MarcoWedel

TextBetween('[2003.000000]','[','.')

MarcoWedel

QlikCommunity_Thread_150322_Pic1.JPG

hope this helps

regards

Marco

ashfaq_haseeb
Champion III
Champion III

Hi

try like below.

=left((purgechar('[2003.000000]','[.]')),4)

Regards

ASHFAQ

its_anandrjs

Hi,

Another Possible way is

LOAD
Date#(Left(KeepChar(Number,0123456789),4),'YYYY') as Year1,
Mid(Number,2,4) as Year2,*;

LOAD Number
FROM
[Data.xlsx]
(
ooxml, embedded labels, table is Sheet1);


Years.PNG

Regards

Anand

maxgro
MVP
MVP

or

=mid('[2003.000000]', 2,4)

or

=date#(mid('[2003.000000]', 2,4),'YYYY')

Not applicable
Author

hi Anand,

I m getting this data in crosstable transformation from excel...

in excel it is 2003 but in qlikview it is like

t1:

CrossTable(year, amount, 2)

LOAD Office,

     Department,

     [2003.000000] as 2003,

     [2004.000000] as 2004,

     [2005.000000] as 2005,

     [2006.000000] as 2006,

     [2007.000000] as 2007

FROM

[..\ct2.xlsx]

Anonymous
Not applicable
Author

When you run this do you get what are after ?

If not then could share a sample xls ?

Not applicable
Author

In table box am getting same year column, and value as 2003.0000, 2004.0000 if i am not aliasing it as i done above and so on i just wanna to remove decimal part from it for reporting.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

How about this (using your code and the second example that Massimo posted below):

t1:

CrossTable(year, amount, 2)

LOAD Office,

     Department,

     [2003.000000],

     [2004.000000],

     [2005.000000],

     [2006.000000],

     [2007.000000]    // Or use LOAD * if your Excel doesn't contain anything else

FROM [..\ct2.xlsx] (ooxml, ...);

T1Temp:

NOCONCATENATE

LOAD Office, Department,

     date#(mid(year, 2, 4), 'YYYY') AS year,

     amount

RESIDENT t1;

DROP Table t1;

RENAME Table T1Temp to t1;

You can try to combine them into a single block by turning the second LOAD into a preceding load.

Best,

Peter