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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculated Fields

Hi

I am creating a table where some of the fields I want are dependant on previously calulated fields, is there an easy way to do this

For example if I have calculated field as follows,

Load

* as ,

then if I want field to be * how can I do this without having to script * *

Thanks

A.

Labels (1)
1 Solution

Accepted Solutions
puttemans
Specialist
Specialist

Hi Adrian,

If you want the other variables still to be visible, please add a '*,'

Load  *,

((Pallets - DirectPallets) * DistributionCost) + (DirectPallets * DirectDistributionCost) as TotDistribution;

View solution in original post

8 Replies
MK_QSL
MVP
MVP

Provide some sample data with your sample apps... will look into this..

tresB
Champion III
Champion III

Try preceding load like,

Load

* as ;   // preceding load

         

Load

* as

From <>;

puttemans
Specialist
Specialist

Hi Adrian,

If you want to calculate it in the same table, and you don't want to re-script the formula, then a preceding load may help you.

This looks like

Table X

LOAD

c*d as Y;

LOAD

a*b as C

FROM .....

Notice the ';' after the first load statement

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try Preceding Load for this

TableName:

LOAD

*,

* AS E;

Load

* as ,

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

robert_mika
MVP
MVP

Try this:

t1:

load * Inline

[

A,B,D

1,2,3 ]

;

t2:

load

A*B as c

resident t1

;

temp:

load c as C  resident t2;

join

load D  resident t1;

;

final:

load C*D as E resident temp;

drop table t1,t2,temp

Anonymous
Not applicable
Author


I've tried your method but it's not quite working.  I have a table which has a record for each sale and I'm trying to achieve a calculation of the distribution costs for each sale. So if my original tabel has 50 records, I should get a new table with 50 records, however I am getting 50 records for each sale.  This is the script and qvw attached

'CalcTest':

Load ((Pallets - DirectPallets) * DistributionCost) + (DirectPallets * DirectDistributionCost) as TotDistribution;

Load
Year,
Week,
Product,
Units,
Pallets,
Pallets * DirectPallet% as DirectPallets,
DistributionCost,
DirectDistributionCost
resident 'Sheet1';

drop field DistributionCost,
DirectDistributionCost,
DirectPallet%;

puttemans
Specialist
Specialist

Hi Adrian,

If you want the other variables still to be visible, please add a '*,'

Load  *,

((Pallets - DirectPallets) * DistributionCost) + (DirectPallets * DirectDistributionCost) as TotDistribution;

mukesh24
Partner - Creator III
Partner - Creator III

Hi,

U can achieve these through Preceding Load.

Regards,

Mukesh Chaudhari