I wrote a case statement returning if ladder_value_lh2 is < or > ladder_value_lh1:
CASE
WHEN ladder_value_lh1>ladder_value_lh2 THEN 'up'
WHEN ladder_value_lh1< ladder_value_lh2 THEN 'down'
WHEN ladder_value_lh2 IS NULL THEN 'No Change'
END AS advocacy_moved_up_down_nochange,
Ladder values are made up of 0, A, B, C1, C2, D, and E.
Right now, it doesn't recognize that 0 is less than A (etc). So, if ladder_value_lh1 is 0, and less than ladder_value_lh2 of B, I'd expect down; right now, it's returning 'No Change'.
How do I tell it that 0 is less than A (etc)?
THanks
I would suggest you use field()
s:
(case sign(field(ladder_value_lh1, '0', 'A', 'B', 'C1', 'C2', 'D', 'E') - field(ladder_value_lh2, '0', 'A', 'B', 'C1', 'C2', 'D', 'E'))
when 1 then 'up'
when -1 then 'down'
when 0 then 'no change'
else 'null value'
end)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.