Doug Creighton
08/29/2023, 4:42 PMSELECT SUM(
CASE WHEN {label/price_adjustment_type} = "Fixed"
THEN 1
END )
and this metric does work
SELECT count({label/case_interaction_id} )
WHERE{label/price_adjustment_type} = "Fixed"
What happens with the first one is that it gets classified as an unrelated data item when I choose Date as a "view by"Michael Ullock
08/29/2023, 5:05 PMSUM
function along with a CASE
statement. But there’s no explicit filter for the “Fixed” condition, so even when the condition is not met (when price_adjustment_type
is not “Fixed”), you’re still adding a value of 0 to the sum. This could result in inconsistent behaviour when used in a “view by” context when dealing with dates. To make the first metric more consistent with the second metric and potentially avoid the issue you’re running in to, you can modify it like this:
SELECT SUM(
CASE WHEN {label/price_adjustment_type} = "Fixed"
THEN 1
ELSE 0
END )
Doug Creighton
08/30/2023, 8:31 PMDoug Creighton
09/01/2023, 3:35 PM