Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Add a computed "ACTIVITY LEVEL" dimension for customers in:
ACTIVITY LEVEL possible values:
To compute "avg pairs / day",
you need first to aggregate your calculation to a dimension or set of dimensions
aggr(
if(
nb_of_Orders / nb_of_days >= 3, 'High'
,if(nb_of_Orders / nb_of_days >=1 and nb_of_Orders / nb_of_days < 3 , 'Medium'
,if(nb_of_Orders / nb_of_days >=0.5 and nb_of_Orders / nb_of_days <1, 'Low'
,...
)))
,month)
alternatively you can use the class function but the class function gives you results over fixe-size intervals
i want to do it in the dimension level ... front end i am able to achieve ..
you mean in the script?
then you need to calculate the number of orders group by customer, month
then you do the average calculation per row (customer, month)
then put the if condition to classify the result as either high, medium, low,...
Yes in the script level
Can you give me syntax will be so useful
i am totally strucked
the script would be something like this:
t1:
Load Customer, Date, count(Order_id) as [Number of Orders], Floor(MonthEnd(Date)) - Floor(MonthStart(Date)) + 1 as [Number of days in Month]
resident your_table
group by Customer, Month(Date);
then:
t2:
load * , if(avg>= 3, 'High', if(avg>=1 and avg <3, 'Medium',if(avg>=0.5 and avg <1, 'Low'))) as Classification
load *, [Number of Orders] / [Number of days in Month] as avg
resident t1;
drop table t1;
hope this helps
but I personally prefer doing things on the UI and keep the script as much simple as possible
Explained .. Still they want from the backend even i have done Master dimension...
I am loading the data once done will update .
Thanks in advance....