Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Guys,
I want to create a dynamic bucket on For Quantity field.
Bucket Should be 0-10,10-100,100-1000,1000-10000,.....
thanx.
Hi,
one solution could be also:
t1:
LOAD *,
If(no>=0 and no<10,
Dual('0 - 10',1),
If(no>-10 and no<0,
Dual('-10 - 0', -1),
If(no>=10,
Dual(pow(10,Class(log10(no),1))&' - '&pow(10,Class(log10(no),1)+1), pow(10,Class(log10(no),1))),
If(no<=-10,
Dual('-'&pow(10,Class(log10(-no),1)+1)&' - -'&pow(10,Class(log10(-no),1)), -pow(10,Class(log10(-no),1)))
)
)
)
) as buck
INLINE [
no
0.5
0.9
1
10
23
43
54
100
200
500
1000
2000
5000
10000
20000
99
0
-11
-0.5
-0.9
-1
-10
-23
-43
-54
-100
-200
-500
-1000
-2000
-5000
-10000
-20000
-99
];
hope this helps
regards
Marco
Create a calculated dimension: =class(log10(Field))
len ( round ( [Quantity] ) ) as [Number of digits bucket] ,
hi Gysbert,
can we create this bucket at a backend using this logic because it is showing error.
Probably
Load MyValue, class(log10(MyValue)), ...other fields.... as class
From ...somewhere...;
t1:
LOAD * INLINE [
no
23
43
54
1000
99
-11
];
t2:
LOAD no,Class(log(no)) as buck
Resident t1;
DROP Table t1;
it is giving error for this code at a script level
Bucket Should be 0-10,10-100,100-1000,1000-10000,.....
So.... in which bucket should a value like -11 fall then?
it should be in 0 to - 10,
Bucket should also be for negative for example
....,-1000 to -100,-100 to -10, -10 to 0, 0-10,10-100,100-1000,1000-10000,....
Maybe this:
Load MyValue,
if(MyValue>=0, class(log10(MyValue)),class(-log10(-MyValue))), ...other fields.... as class
From ...somewhere...;
Hi,
one solution could be also:
t1:
LOAD *,
If(no>=0 and no<10,
Dual('0 - 10',1),
If(no>-10 and no<0,
Dual('-10 - 0', -1),
If(no>=10,
Dual(pow(10,Class(log10(no),1))&' - '&pow(10,Class(log10(no),1)+1), pow(10,Class(log10(no),1))),
If(no<=-10,
Dual('-'&pow(10,Class(log10(-no),1)+1)&' - -'&pow(10,Class(log10(-no),1)), -pow(10,Class(log10(-no),1)))
)
)
)
) as buck
INLINE [
no
0.5
0.9
1
10
23
43
54
100
200
500
1000
2000
5000
10000
20000
99
0
-11
-0.5
-0.9
-1
-10
-23
-43
-54
-100
-200
-500
-1000
-2000
-5000
-10000
-20000
-99
];
hope this helps
regards
Marco