Hello! I’m wondering if there’s a way to do a select case when statement that can output a text as opposed to a number. On the link here - is it possible to write such that:: select case when activity_type in (email, meeting) then ‘Code_1’ else ‘Code_2’ end ? the ‘Code_1’, ‘Code_2’ would be text rather than a number
j
Joseph Heun
02/01/2022, 5:52 PM
This should be possible when applying Conditional Number Formatting to the metric. You would define each metric in the case statement to equal a value. For example:
SELECT CASE WHEN (SELECT metric) = 50 THEN 1 ELSE 0 END
Then you could define the custom number formatting as follows:
[=1] YES; [=0] NO
a
aching
02/01/2022, 7:17 PM
Thanks very much Joseph. This is very helpful to know as it opens up new possibilities. For context, I have 10 case statements which I’m trying to build out in a histogram.
aching
02/01/2022, 7:20 PM
SELECT
CASE
WHEN (SELECT metric) = 50 THEN 50
WHEN (SELECT metric) = 51 THEN 51
WHEN (SELECT metric) = 52 THEN 52 ……
WHEN (SELECT metric) = 5000 THEN 90+
ELSE -999 END
the + sign is throwing error, so I just modify it to 999.
and in conditional formatting - I followed the instruction but it doesn’t seem to change it to dimension (which can be sorted numerically)