Case statement with multiple field conditions
Hello,
I'm trying to write a beast mode fiter that looks for a condition in one field and also searches multiple fields to return a "yes" value. Seems simple enough, but...
I want it to:
Look in CPT code field and find all records with CPT code of 20610, then look in 5 diagnosis code fields to exclude the procedures that deal with Osteoarthritis. Something like:
case when `cpt_code` = '20610' AND
`icd_1` <> '71516'
`icd_2` <> '71516'
`icd_3` <> '71516'
`icd_5` <> '71516'
then 'Yes'
else "No'
end
Basically, this would show me all the large joint injections EXCEPT the ones that deal with OsteoArthritis of a joint.
I keep getting syntax errors... any thoughts? The code for OA could exist in any one of the ICD fields, which is why it needs to search all 4 fields for the OA code (test for that condition) before it allows this procedure to show up on the graph. Need help "structuring" the beast mode to accomplish this. Thanks in advance... I don't see any examples of this type of filtering in the Dojo.
Thanks!
Comments
-
Hi,
Give this a try:
CASE WHEN `cpt_code` = '20610' AND
`icd_1` != '71516' AND
`icd_2` != '71516' AND
`icd_3` != '71516' AND
`icd_4` != '71516'
THEN
'Yes'
ELSE
'No'
ENDBasically, you were missing the AND operators and had a double cote in :
«else "No'». The != (not equal) operator is a little faster when comparing text fields but you could still use the <> operator.
Hope this helps.
Ricardo Granada
MajorDomo@Lusiaves
**If the post solves your problem, mark it by clicking on "Accept as Solution"
**You can say "Thank you" by clicking the thumbs up in the post that helped you.0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive