Hello,
I need to create a conditional based on a filtered measure.
I have:
cart_id,count of product_id filtered by has_sold =”Yes”.
I need:
case when count_of_product_id filtered by has_sold = “Yes” > 1 then 1 else 0 end
Basically if the cart has at least one item sold then I need to count that cart only once. When I go to create a calculated field using if or case then Looker says the filtered measure is a string. Is there a way to manage this in Looker?
Thank you in advance for your consideration.
count distinct cartid when has sold yes
If the database you use support distinct with in aggregate function. you can try the below logic.
sum(distinct case when has_sold='Yes' then 1 else 0 end)