I'm trying to nest multiple conditional clauses together and having trouble. Based on the campaign_name, I want a specific calculation completed and value output of 'Good' or 'Bad.'
This formula works properly when only specifying one campaign_name:
CASE WHEN
SUM(case when `campaign_name` = 'VALUE1' AND `Abandon_Time` > 15 then 1
else 0
end)
/
COUNT(`contact_id`)
<= 0.07
THEN 'Good'
ELSE 'Bad'
END
When I add a second conditional statement, it appears as if the second statement overwrites the first:
CASE WHEN
SUM(case when `campaign_name` = 'VALUE1' AND `Abandon_Time` > 15 then 1
else 0
end)
/
COUNT(`contact_id`)
<= 0.07
THEN 'Good'
WHEN
SUM(case when `campaign_name` != 'VALUE1' AND `Abandon_Time` > 15 then 1
else 0
end)
/
COUNT(`contact_id`)
<= 0.05
THEN 'Good'
ELSE 'Bad'
END