Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CASE Statement order of precedence

679919Feb 16 2009 — edited Aug 8 2012
The question i have is in regards to the CASE statement.

If i have the following CASE statement in a calculation, and use the calculation to populate the column header, it returns 2 columns, one for 'Mexico' and one for 'Exclude' - That is good

Statement 1:
CASE WHEN ( "Customers (Sales History)".Country = 'MX' )
THEN 'Mexico'
ELSE 'Exclude'
END

So i have sucessfully extracted out sales from Mexico, now i want break those sales into 2 categories, 'Primary' and 'Secondary'. If i use the below case statement, I was expecting to get 3 column headers, one for 'Primary' one for 'Secondary' and one for 'Exclude', but instead I only get 1 column header for exclude. Im sure it has something to do with order of precedence, but could someone explain the logic of why discover handles it this way, and how to get around it?

Statement 2:
CASE WHEN ( "Customers (Sales History)".Country = 'MX' )
THEN
CASE WHEN ( Item Groups.Sales Type Id <> 3)
THEN 'Primary'
ELSE 'Secondary'
END
ELSE 'Exclude'
END

As a side note, if i use statement 2 and set a condition "Statement 2 <> 'Exclude'" , the result will be the columns 'Primary' & 'Secondary'

Thanks
Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 5 2012
Added on Feb 16 2009
5 comments
3,521 views