# cumcount {#cumcount}

## Syntax {#syntax}

`cumcount(X)`

Please see [Cumulative Window Functions](../Themes/cumFunctions.md) for the parameter description and windowing logic.

## Details {#details}

Cumulatively calculate the number of non-null elements in *X*.

## Examples {#examples}

```
x=[1,2,NULL,3,4,NULL,5,6]
cumcount(x);
// output: [1,2,2,3,4,4,5,6]

m=matrix(1 2 3 NULL 4, 5 6 NULL NULL 8);
m;
```

|\#0|\#1|
|---|---|
|1|5|
|2|6|
|3||
|||
|4|8|

```
cumcount(m);
```

|\#0|\#1|
|---|---|
|1|1|
|2|2|
|3|2|
|3|2|
|4|3|

