Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sth_wch004
Contributor III
Contributor III

Qlik Sense - Reuse calculated field in the same load script

Dear Community,

How to reuse calculated field in the same load script?

[Table]:

LOAD

  [Invoice No]

, [Quantity]

, [Price]

, [Quantity] * [Price] AS [Amount]

, [Amount]  * {Rate] AS [GST]

FROM [lib://Files/table.xlsx]

(ooxml, embedded labels, table is Sheet1);

In the same load script, same table

[GST] =  [Amount] * {Rate] AS [GST]

instead of

[GST] = ( [Quantity] * [Price] ) * {Rate] AS [GST]

1 Solution

Accepted Solutions
luismadriz
Specialist
Specialist

[Table]:

LOAD *,

        [Amount] * [Rate] AS [GST];

LOAD

  [Invoice No]

, [Quantity]

, [Price]

, [Rate]

, [Quantity] * [Price] AS [Amount]

FROM [lib://Files/table.xlsx]

(ooxml, embedded labels, table is Sheet1);

Cheers

Luis

View solution in original post

2 Replies
luismadriz
Specialist
Specialist

[Table]:

LOAD *,

        [Amount] * [Rate] AS [GST];

LOAD

  [Invoice No]

, [Quantity]

, [Price]

, [Rate]

, [Quantity] * [Price] AS [Amount]

FROM [lib://Files/table.xlsx]

(ooxml, embedded labels, table is Sheet1);

Cheers

Luis

sth_wch004
Contributor III
Contributor III
Author

Thanks Luis,

Actually I have more than hundred of calculated fields

and so on will be like this?

[Table]:

LOAD *

    , etc....

LOAD *

    , [GST] + [Amount] AS [Gross Amount];

LOAD *

    , [Net Amount] * [Rate] AS [GST];

LOAD [Invoice No]

,[Quantity]

,[Price]

,[Rate]

    ,[Quantity] * [Price] AS [Net Amount]

FROM [lib://Desktop/table.xls]

(biff, embedded labels, table is Sheet1$);