Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have 4 clients, that can be happy by nature or not:
Client ID | Happy client |
---|---|
1 | 1 |
2 | 0 |
3 | 1 |
4 | 1 |
These clients come and leave the service desk of our company as follows:
(We LEFT JOINed the happiness onto the table).
Time | Client ID | Happy client |
---|---|---|
1 | 1 | 1 |
2 | - | - |
3 | 2 | 0 |
4 | 2 | 0 |
4 | 3 | 1 |
5 | 2 | 0 |
5 | 3 | 0 |
5 | 4 | 1 |
6 | 3 | 1 |
6 | 4 | 1 |
If one client is happy, the company has a good time.
Time | Good time |
---|---|
1 | 1 |
2 | 0 |
3 | 0 |
4 | 1 |
5 | 0 |
6 | 1 |
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
use
Load
field 1,
field 2
sum( if(Happy_client>0,1))
from path
group by Field 1 ,Field2;
hope this helps
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: