Case statement when two different fields are null

Reply
Highlighted
Yellow Belt

Case statement when two different fields are null

I need to filter a data set down to results where both the SQ and SQ_1 fields are null. How would I do this with a CASE statement would another approach work better?

Catherine Hayes
Manager, Business Analytics and Project Operations
The Channel Company

Accepted Solutions
Highlighted
Green Belt

Hey @cthtcc ,

 

You could name your beast mode something like "SQ and SQ_1 are null?" and use this code

 

CASE WHEN `SQ` IS NULL AND `SQ_1` IS NULL THEN 'Yes' ELSE 'No' END

Then drop that into the Filter section of the Analyzer and select only 'Yes'

 

You can test to make sure it works by creating a table card with three columns: SQ, SQ_1 and your new "SQ and SQ_1 are null?" beast mode and scan the lines to make sure it is acribing the yes/no condition appropriately (note: you would do this before choosing only 'Yes' in the Filter section mentioned above)

View solution in original post


All Replies
Highlighted
Green Belt

Hey @cthtcc ,

 

You could name your beast mode something like "SQ and SQ_1 are null?" and use this code

 

CASE WHEN `SQ` IS NULL AND `SQ_1` IS NULL THEN 'Yes' ELSE 'No' END

Then drop that into the Filter section of the Analyzer and select only 'Yes'

 

You can test to make sure it works by creating a table card with three columns: SQ, SQ_1 and your new "SQ and SQ_1 are null?" beast mode and scan the lines to make sure it is acribing the yes/no condition appropriately (note: you would do this before choosing only 'Yes' in the Filter section mentioned above)

View solution in original post

Highlighted
Yellow Belt

Thanks very much!

Catherine Hayes
Manager, Business Analytics and Project Operations
The Channel Company
Announcements
Stand out in the Dojo: Choose your own recognizable username and add a unique profile photo in your profile settings.