February 19, 2014 at 1:53 pm
Hello,
How do I properly write a CASE statement for the following business logic:
I want three of the following fields to be true in order to return 'Y'.
For example:
If field name 'Accepted' = 1 AND field 'StepNo' = '1' and field 'Visit' = 'V1'
Otherwise, I want it to return 'N'.
I have tried the following code below and it is not working. Any suggestions? Thank you in advance!
, CASE WHEN Accepted = '1' AND StepNo ='1' AND Visit ='V1'
THEN 'Y' ELSE 'N' END AS 'StatusQ (Col N)'
February 19, 2014 at 2:09 pm
It seems correct to me. What's the problem? Can you post sample data (check my signature to know how to do it properly)?
February 19, 2014 at 2:17 pm
When you say, "not working" what do you mean? Do you get an error? Do you get unexpected results? If unexpected results, what are the values that give you unexpected results and what is the expected result?
Russel Loski, MCSE Business Intelligence, Data Platform
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply