MovingCount
Last updated
Was this helpful?
Last updated
Was this helpful?
The MovingCount function counts the number of non-null values within a column in a moving window.
Function Arguments
[Column] (required) - The column of numbers, text, or dates to count. Null values are skipped.
above (required) - The first row to include, counting backward from the current row.
below (optional) - The last row to include, counting forward from the current row. Defaults to 0 (current row will be the last row included).
πWhen using this function without a sort enforced, there can be unexpected results. In order to ensure that the values are stable, verify that there is a sorted column within the table.
A table contains data about the amount of violations found by day during inspections in restaurants. The MovingCount function can be used to find the number of non-null values within different moving windows.
With [Violations] as the column argument and 4 as the above argument, the number of non-null values are calculated for each day along with the four previous days. Since the below argument was not specified, it defaults to 0.
β``` MovingCount([Violations], 0, 4)
Here, the above argument is 2, so the previous two days will be included in the count. In addition, the below argument is 2, so the following two days will be included as well.
β``` MovingCount([Violations], 8, -4)