Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to add calculated column using the calculated column

Hello All

I want to create a calculated column from an calculated column.

Below is the example:

TEST:

Load [Name],

[Date of Birth],

if([Date of Birth]='','Null',[Date Of Birth]) as [DOB],           /* First Calculated Column*/

timestamp([DOB],'YYYY') as 'Ýear',                          /* Second calculated column derived from First Calculated Column [Date of Birth] */

month([DOB]/3) as 'Quater'                                     /* Third calculated column derived from First Calculated Column [Date of Birth]  */

From

[abc/test.xlsx]

I am getting an error message as  [DOB] not found. But if i remove the second and third calculated columns then no error the script executes successfully.

4 Replies
roharoha
Valued Contributor III

Re: How to add calculated column using the calculated column

LOAD

* ,

timestamp([DOB],'YYYY') as 'Ýear',     

month([DOB]/3) as 'Quater' ;                      

Load [Name],

[Date of Birth],

if([Date of Birth]='','Null',[Date Of Birth]) as [DOB],           /* First Calculated Column*/

[Date of Birth] ;


Not applicable

Re: How to add calculated column using the calculated column

Sorry, but this is not working correctly. Now I am not getting any error message but the data is not coming thru correctly.

This is the code I have used.....

LOAD
*,
Timestamp(DOB,'ÝYYY') as Year,
month(DOB/3) as Quater;

LOAD
Name,
Date as DOB
  
FROM

(
ooxml, embedded labels, table is Sheet1);

O/p:

roharoha
Valued Contributor III

Re: How to add calculated column using the calculated column

... this is another question, you never said what you tried to achieve, so please explain...

Not applicable

Re: How to add calculated column using the calculated column

Hi

have to use ceil or dual function to get the quarter

something like ceil(month(dob)/3) as quarter or dual('q' & ceil(month(dob)/3), ceil(month(dob)/3)) as quarter

coming to the calculated fields, you cant use those in the same table. use resident load and use them

can you please share exactly what you trying to achieve here....

Community Browser