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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables in the data load editor with conditions

Datafile:

Udklip.JPG

I like to calculate some variables when loading my data but I'm not sure how to deal with the the syntax.

(I've LOTS OF variables to calculate and like to do it when loading data instead of calculate on the fly using expressions)

1) I like to create a variable called 'G1' which should sum Product AB01 combined with Salespoint 1200 (In this case result = 3)

2) I like to create a variable called 'G2' which should sum Product QP01 combined with Salespoint 1200 + Product QP01 combined with Salespoint 1400 (In this case result = 5)



1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Table1:

LOAD Product, SalesPoint, Quantity FROM ...

Table2:

LOAD

     'G1' as MyField,

     sum(Quantity) as result

RESIDENT

     Table1

WHERE

     Product = 'AB01' and SalesPoint = 1200

;

CONCATENATE (Table2)

LOAD

     'G2' as MyField,

     sum(Quantity) as result

RESIDENT

     Table1

WHERE

     Product = 'QP01' and (SalesPoint = 1200 or SalesPoint = 1400)

     ;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Table1:

LOAD Product, SalesPoint, Quantity FROM ...

Table2:

LOAD

     'G1' as MyField,

     sum(Quantity) as result

RESIDENT

     Table1

WHERE

     Product = 'AB01' and SalesPoint = 1200

;

CONCATENATE (Table2)

LOAD

     'G2' as MyField,

     sum(Quantity) as result

RESIDENT

     Table1

WHERE

     Product = 'QP01' and (SalesPoint = 1200 or SalesPoint = 1400)

     ;


talk is cheap, supply exceeds demand