2 Replies Latest reply: Apr 7, 2014 3:39 PM by Nicole Smith

# Conditional count with OR

What is the correct syntax to count instances of two filters using an OR?

Basically I need to count:

Count ( {<BLOB={'>0'}>} DISTINCT DeviceID ) + Count ( {<FOO={'>0'}>} DISTINCT DeviceID ), but then their might be repeated DeviceID's for devices that have both BLOB and FOO.

So, looking for something like this:

Count ( {<BLOB={'>0'} or FOO={'>0'} >} DISTINCT DeviceID )

Count ( {<BLOB={'>0'} || FOO={'>0'} >} DISTINCT DeviceID )

• ###### Re: Conditional count with OR

Hi Jessica,

try this:

Count ( {<BLOB={'>0'} + FOO={'>0'}>} DISTINCT DeviceID )

best regards

• ###### Re: Conditional count with OR

Count ({<BLOB={'>0'}>+<FOO={'>0'}>} DISTINCT DeviceID )

From QV Help:

## Set Operators

Several set operators that can be used in set expressions exist. All set operators use sets as operands, as described above, and return a set as result.

+ Union. This binary operation returns a set consisting of the records that belong to any of the two set operands.

- Exclusion. This binary operation returns a set of the records that belong to the first but not the other of the two set operands. Also, when used as a unary operator, it returns the complement set.

* Intersection. This binary operation returns a set consisting of the records that belong to both of the two set operands.

/ Symmetric difference (XOR). This binary operation returns a set consisting of the records that belong to either, but not both of the two set operands.