Case Statement or Formula for creating a flag
I have to create a flag in a dataset where
(IF columns A.a and B.a = A.b and B.b ) then I have to check cols A.c = B.c or A.d = B.d
My Data is like
Can someone help me in case statement. The one I have is not showing correct results. First two columns have to match to figure out discrepancies in next cols. If cols match it is 1 and if c and d cols are not matching then its 0.
Comments

CASE WHEN `A.a` = `B.a` AND `A.b` = `B.b` THEN CASE WHEN `A.c` = `B.c` AND `A.d` = `B.d` THEN 1 ELSE 0 END END
This will return NULL if A.a and A.b do not equal B.a and B.b resepctively.
1 if c and d match and a and b match
0 if they don't but a and b match
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 
@User2021 are you saying that if A.a = B.a and A.b = B.b then check if either A.c = B.c or A.d = B.d? If so, I think this is the case statement logic you want:
CASE
WHEN (A.a = B.a and A.b = B.b ) THEN (CASE WHEN A.c = B.c THEN 1 WHEN A.d = B.d THEN 1 ELSE 0
END)
ELSE 0
END
1
Categories
 All Categories
 1.5K Product Ideas
 1.5K Ideas Exchange
 1.4K Connect
 1.1K Connectors
 283 Workbench
 4 Cloud Amplifier
 4 Federated
 2.7K Transform
 90 SQL DataFlows
 569 Datasets
 2K Magic ETL
 3.4K Visualize
 2.4K Charting
 601 Beast Mode
 15 App Studio
 29 Variables
 600 Automate
 151 Apps
 418 APIs & Domo Developer
 29 Workflows
 2 DomoAI
 28 Predict
 12 Jupyter Workspaces
 16 R & Python Tiles
 362 Distribute
 99 Domo Everywhere
 261 Scheduled Reports
 2 Software Integrations
 98 Manage
 95 Governance & Security
 15 Product Releases
 Community Forums
 37 Getting Started
 28 Community Member Introductions
 90 Community Announcements
 4.8K Archive