This is an old revision of the document!


Count

Counts the number of records, rows or times where a condition is true.

Parameters

NameDefaultMeaning
nameThe name of the value to be written to the frame
whereA Substitutable condition - the count increases by 1 for every row that matches the rule.
whenA Substitutable condition - the count increases by 1 for every the the rule becomes 'true'

Description

This function performs a count, either of…

1) The number of rows that match a condition, or 2) The number of times a condition became true

To count each individual row, use the where parameter. This will count each row individually - if we where each value is yes in the table below…

Row #Value
1Yes
2No
3Yes
4Yes
5Yes
6No

…the answer will be 4, since there are four rows where the value is 'yes'.

Alternatively if we used when instead of where, the answer would be '2', because the value only changed to 'Yes' twice.

Example

If the frame contains the following attributes…

Row #Value
1Yes
2No
3Yes
4Yes
5Yes
6No
{
   "type": "count",
   "when": "{Value}='Yes'",
   "name": "Yesses"
}

The final results will include a “Yesses” attribute with a value of 2.