Placeholder

Customer Forum

Using an OR statement to report across multiple checkboxes on a record

Workbooks Support Posted: 2014-08-29 09:29

What if you create a report which has more than one column with checkboxes in it and you would like to limit the results to only show rows where either, column A is true, column B is true, OR both column A and column B are true?

You cannot simply add two criteria that looks at both these columns to filter for when they are true because you will miss cases where, either just column A is true OR just column B is true, it will only return results where both column A AND column B is true. 

It will make more sense with an example.

Below is a report where we want to limit our results to give us Organisations where No email OR No sales calls is true (click to enlarge).

By adding the criteria as described earlier, we get the following results.

Which is not what we want...

Instead, we will need to add a calculated column so that we get a 1 when either No email is true (i.e., it equals 1) OR when No sales calls equals 1.

This is achieved by adding a calculated column which uses the following formula:

IF(no_email_soliciting = 1 OR no_phone_soliciting = 1,1,0)

We can give this column a name such as 'No Email or Phone Test'.

Now, if we look at the report, the column we just added will give us a 1 when either the No email or No sales calls is true, it will give a 0 otherwise. 

We are now actually interested in returning results where this newly created calculated column 'No Email or Phone Test' equals 1, we do this by adding a calculated criteria.

Now we have the results we are after, ready for further analysis - a list of Organisations where either the No email OR No sales calls checkbox is true.

Workbooks Support Posted: Wed, 11.02.2015 - 17:16

See the table below for examples of how you can use different filter types:

 

Field Filter Type Criteria Calculated Column
Name starts with Alan name LIKE 'Alan%'
Name contains Alan name LIKE '%Alan%'
Name does not contain Alan name NOT LIKE '%Alan%'
Name equals Alan name = 'Alan'
Name does not equal Alan name != 'Alan'
Job Role is blank   person_job_role IS NULL or  person_job_role = ' '
Job Role is not blank   person_job_role IS NOT NULL or  person_job_role != ' '