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?

Best Answer

  • DDalt
    DDalt Member
    Answer ✓

    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)

Answers

  • DDalt
    DDalt Member
    Answer ✓

    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)

  • Thanks very much!