@markmegerian @Jon_Herke
I am trying to apply where condition after POST Accum in one line) but this is giving me an error on where condition, I want to do it in one line. Can you please help
profiles_spend = select s from all_profiles:s-(profile_purchase:e)-Orders:t-(order_items:ee)-Products:tt ACCUM
s.@total_spend +=ee.item_qty*tt.item_price, s.@distinct_weeks+=t.week_id
post-ACCUM s.@avg_weekly_spend = s.@total_spend/s.@distinct_weeks.size() where s.@avg_weekly_spend > 3000 and s.@avg_weekly_spend <= 4000;
But it works in two different variables
profiles_spend = select s from all_profiles:s-(profile_purchase:e)-Orders:t-(order_items:ee)-Products:tt ACCUM
s.@total_spend +=ee.item_qty*tt.item_price, s.@distinct_weeks+=t.week_id
post-ACCUM s.@avg_weekly_spend = s.@total_spend/s.@distinct_weeks.size();
prof = select s from profiles_spend:s where s.@avg_weekly_spend > 3000 and s.@avg_weekly_spend <= 4000;
PRINT prof;