Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I need a slightly complicated chart. I want to build a pie chart with count with an integrated condition instead of a field.
My condition is:
if orders_sum is more than 7000, then 'target customer', if more than 3000 then 'on the border', otherwise 'not targeted'
Further, based on this condition, i want the pie chart to show the number of customers for each of the resulting categories: target, on the border, not targeted. I know that it is possible to load field in the script, but this is not the best option for our data, so i would like to build this by calculations in the chart.
So I need something like aggr( count( <{sum(order_cost)={>7000} }> user_id), user_id) but all the options i've tried give an error or null
Thanks for any tips!
Add a Calculated Dimension as below
= AGGR( if(sum(order_cost)>7000,'target customer'
,if(sum(order_cost)>3000,'on the border' ,'not targeted' ) ) , user_id)
Add Measure as below
=count(distinct user_id)
Hi @ZimaBlue ,
Why don't you create a master dimension which you can use in your pie chart?
Add a Calculated Dimension as below
= AGGR( if(sum(order_cost)>7000,'target customer'
,if(sum(order_cost)>3000,'on the border' ,'not targeted' ) ) , user_id)
Add Measure as below
=count(distinct user_id)