Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
samvile18
Creator III
Creator III

Script help

Morning all,

I have the following script which is loading two tables into one:

LOAD Age,

          WRKTYPE,

SQL Select *

FROM Age.qvd

Left Join

Load WRKTYPE,

          ASL,

SQL Select *

FROM ASL.qvd

Now I need to add a calculated field based on the Age-ASL...how do I do this considering the field doesn't exist within the table until I add it?       

1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III

Use like this :

Table1:

LOAD Age,

          WRKTYPE,

SQL Select *

FROM Age.qvd;

Left Join

Load WRKTYPE,

          ASL,

SQL Select *

FROM ASL.qvd;

TableCombined:

Load

Age

,WRKTYPE

,ASL

,if(Age='X' and ASL='Y',1,0) as Numerator

Resident Table1;

DROP Table Table1;

View solution in original post

4 Replies
sujeetsingh
Master III
Master III

Use like this :

Table1:

LOAD Age,

          WRKTYPE,

SQL Select *

FROM Age.qvd;

Left Join

Load WRKTYPE,

          ASL,

SQL Select *

FROM ASL.qvd;

TableCombined:

Load

Age

,WRKTYPE

,ASL

,if(Age='X' and ASL='Y',1,0) as Numerator

Resident Table1;

DROP Table Table1;

Not applicable

Try this:

TempTable:

Load WRKTYPE,

         Age-ASL AS [Your field]

Resident <Your table name>;

LEFT JOIN <Your table name>

Load *

Resident TempTable;

Drop table TempTable;

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this

DataTemp:

LOAD Age,

          WRKTYPE;

SQL Select *

FROM Age.qvd

Left Join

Load WRKTYPE,

          ASL;

SQL Select *

FROM ASL.qvd

Data:

LOAD

*,

Age - ASL AS CalculatedValue

RESIDENT DataTemp;

DROP TABLE DataTemp;

Regards,

Jagan.

er_mohit
Master II
Master II

Temp:

LOAD Age,

          WRKTYPE,

SQL Select *

FROM Age.qvd

Left Join

Load WRKTYPE,

          ASL,

SQL Select *

FROM ASL.qvd;

Final:

load *

Age-ASL as Calculated

resident Table;

drop table Temp;

hope it helps