Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Anonymous
Not applicable
Author

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
Author

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:

Anonymous
Not applicable
Author

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

Not applicable
Author

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....