countIf function in the Factory

The countIf function number of times a distinct value, which meets a specified condition, is present in an attribute.


Parameters

countIf(condition,group)

Parameter

Description

condition

The condition that must be met for the value to be counted. The condition parameter is mandatory.

group

The attribute by which you want to further group results.


Example - countIf(condition)

Description

Screenshot

In the example we want to count the number of times the value in the Month attribute is November.

We write the following formula in the formula bar:

countIf($"Month" is $"November")

Only the values which satisfy the conditions will be counted.

In the Month attribute, the value is November in 8734 rows.

Example - countIf(condition, group)

Description

Screenshot

If we want to group our results, we just need to add a group parameter.

In this example, we want to group our results by the Country attribute values, so we type the formula:

countIf($"Month" is $"November", $"Country")

The results are:

  • In 1278 rows the value of Month is November and the value of Country is Canada;

  • In 1872 rows the value of Month is November and the value of Country is Australia;

and so on.