Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating fields based on each other - best approach

Hi,

I have a rather large QVD file containing ~7 Million records.

These deal with usage data And I have a Teradata script that I need to rebuild with Qlikview logic.

In Teradata it was like

SELECT

field1,

field2,

field1+field2 newField1

newField1/field1 newField2

....

This is a simplified example, there are complex calculations in the original script.

As far as I know, I can only create newField1 in the same step:

LOAD *,

          field1+field2 as newField1

FROM ....

What about newField2? Do I Need to insert the complex calculations instead using the Name:

LOAD *,

          field1+field2 as newField1,

        (field1+field2)/field1 as newField2

FROM ....

This will drive me mad....

Or do another load over all records to add the field? This will take a lot of time...

Thanks for any advice 🙂

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

Try preceding load

Load *,newField1/field1 as newField2;

LOAD *,

          field1+field2 as newField1

FROM ....

View solution in original post

4 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try preceding load

Load *,newField1/field1 as newField2;

LOAD *,

          field1+field2 as newField1

FROM ....

Not applicable
Author

Alright, thanks.

Is this the fastest option, by the way? I needed 6 preceding loads overall because of all the dependencies and the load now takes about 17 minutes.

shraddha_g
Partner - Master III
Partner - Master III

Preceding load is better than Resident I guess

Not applicable
Author

I'm still not satisfied with the load time. Anyhow, you're answer is correct, marked it accordingly.