Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create new variable in load script with OR

We have 4 clients, that can be happy by nature or not:

Client IDHappy client
11
20
31
41

These clients come and leave the service desk of our company as follows:

(We LEFT JOINed the happiness onto the table).

TimeClient IDHappy client
1

1

1
2--
320
420
431
520
530
541
631
641

If one client is happy, the company has a good time.

TimeGood time
11
20
30
41
50
61

Now, how do I create the "Good time" field in the load script? If it were just in a table chart, we could use "if(sum(Happy_client>0,1))" as expression. But this does not work in the script. How can we do it? (Basically, it's an OR expression over all "Happy_client" at a "Time").

Cheers,

Jonas

2 Replies
SunilChauhan
Champion
Champion

use

Load

field 1,

field 2

sum( if(Happy_client>0,1))

from path

group by  Field 1 ,Field2;

hope this  helps

Sunil Chauhan
Not applicable
Author

Thank you Sunil!

But I do not understand your syntax.

Did you mean like this?

Load

Time,

Client_ID,

if(sum(Happy_client)>0,1) as Good_time,Good time Good timeGood time

from path

group by  Time ,Client_ID;

Sounds good, but I would like to use no "if", because this makes everything very slow. So I use an "OR":

1-product(1-Happy_client)

But how is the function for Products called?

Question moved here:

http://community.qlik.com/message/194893#194893http://