Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
TALK_DURATION,
TALK_DURATION/60 as talk_duration_min,
if(talk_duration_min=0,0,talk_duration_min) as clus
Hello everbody I have written the above mentioned script in Load statment but unfortunately I am unable to load the script due top below mentioned error.
Error:Field not found - <talk_duration_min>
Need your kind support.
Plus I have different value from 0 to 54 in talk_duration_min the main thing is I want to make a cluster. like
0-1 min
2-5 min
6-10 min
11-15min
16-20 min
>20min
Yes because your expression condition is not correct try with
Load
TALK_DURATION,
if((TALK_DURATION / 60) = 0, '1min',
if((TALK_DURATION / 60) >= 1 and (TALK_DURATION / 60) <= 5,'1-5min',
TALK_DURATION/60)) as clus
From Location;
If possible share sample file.
Regards
Anand
Try as below
TALK_DURATION,
TALK_DURATION/60 as talk_duration_min,
if(TALK_DURATION/60=0,0TALK_DURATION/60) as clus
Load
*,
If(clus >0 and clus <=1, '0-1 min',
If(clus >1 and clus <=5, '2-5 min',
If(clus >5 and clus <=10, '6-10 min',
If(clus >10 and clus <=15, '11-15 min',
If(clus >15 and clus <=20, '16-20 min','>20 min')))));
Load
TALK_DURATION,
TALK_DURATION/60 as talk_duration_min,
if(TALK_DURATION/60=0,0TALK_DURATION/60) as clus
From TableName;
TALK_DURATION,
TALK_DURATION/60 as talk_duration_min,
if(talk_duration_min=0,0, TALK_DURATION/60 ) as clus
Before rename expression used in the script.
Regards
Anand
Thanks everbody for the supprot. But unfortunately it didnot workout. Only below mentioned query worked but for one calcuation but I need 4 other if statements as well
if(TALK_DURATION/60=0,'1min',TALK_DURATION/60) as clus
Is it not possible to write somthing like
if(TALK_DURATION/60=0,'1min',TALK_DURATION/60, if(TALK_DURATION/60 >=1 and <=5, '1-5min', TALK_DURATION/60)) as clus
it gives an error
Error in expression:
')' expected
Load
*,
If(clus >0 and clus <=1, '0-1 min',
If(clus >1 and clus <=5, '2-5 min',
If(clus >5 and clus <=10, '6-10 min',
If(clus >10 and clus <=15, '11-15 min',
If(clus >15 and clus <=20, '16-20 min','>20 min'))))) as Flag;
Load
TALK_DURATION,
Time(Time#(Num#(TALK_DURATION,'#0'),'ss'),'m') as talk_duration_min,
if(TALK_DURATION/60=0,0,TALK_DURATION/60) as clus
Inline
[
TALK_DURATION
100
120
75
40
150
180
10
15
500
1000
2000
];
Yes because your expression condition is not correct try with
Load
TALK_DURATION,
if((TALK_DURATION / 60) = 0, '1min',
if((TALK_DURATION / 60) >= 1 and (TALK_DURATION / 60) <= 5,'1-5min',
TALK_DURATION/60)) as clus
From Location;
If possible share sample file.
Regards
Anand
Thank you Anand Chouhan, The mistake you pointed out was acutally the pain point. I appericate everbody else for the support as well.
Thanks Glad the help you
Regards
Anand