# CountDistinctIf

The **CountDistinctIf** function returns the number of unique values within a column or group for which all given conditions are true. You can use [operators](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/operators "mention") in conditions.

### Syntax

`CountDistinctIf([field], condition 1, condition 2+...)`

The function has the following arguments:

|              |                                                                                                                             |
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| field        | (required) The column of values to be counted. Duplicate and Null or empty values are skipped.                              |
| condition 1  | (required) The condition to test. If the condition is true, then the row will be counted.                                   |
| condition 2+ | (optional) Additional conditions to test. If multiple conditions are used, they must all be True for the row to be counted. |

### Examples

`CountDistinctIf([City], [Population] > 5000)`

Finds the number of unique city names where the population is greater than 5000.

`CountDistinctIf([City], [Population] 5000 AND [Population] < 10000, [State] = "Ohio")`

Finds the number of unique city names where the population is between 5000 and 10,000 and the state is Ohio.
