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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Load Script

I have following fields in my data table

Note     Amount

100      100

101      500

102      300

103      400

200      800

I want to create following variable in my load script

if Note=100 then sum amount   as X

if note =101 then sum amount  as Y

if Note =200 then sum amount as Z

I have written the load statement like this but it does noe work. Pls help me with correct script

if(NOTE='100',sum(AMOUNT))as X

12 Replies
preminqlik
Specialist II
Specialist II

if you want to create in load script;

orginal:

Load note,

Amount

from xyz;

X:

Load note               as               XNote,

sum(Amount)          as          XAmt

reisdent orginal where note=100 group by note;

Y:

Load note               as               YNote,

sum(Amount)          as          YAmt

reisdent orginal where note=101 group by note;

let vX=Peek('XAmt',0,'X');

let vY=Peek('YAmt',0,'Y');

qlikpahadi07
Specialist
Specialist

I am not sure with the Requirement but it seems you can simple create a Table and with dimension Note  and expression as Sum(Amount) you will get desired output.

and same as backend

LOAD BAL_ACCT_CODE,

     NOTE,

    CLA_CODE,

     Sum(AMOUNT) as Amount,

    BCOD

FROM

[..\QVD\FACT_Table\Trial_Balance.qvd]

(qvd) Group by BAL_ACCT_CODE,NOTE...all Dimensions

WHERE YEAR='2013'

Else upload a Sample Application and desired output you need

preminqlik
Specialist II
Specialist II

cheers same thought .....after finishing the qlikpahadi07 statements .....in chart don't take any dimension , just write the following expression :

sum({<Note={101}>}Amount)