Count

count

The count function is an aggregate function, which counts the number of rows passing through it.

Count must be using in an aggregate type of expression.

Spec

count()

Parameters

None

Return Value

count - Int64 value

Example

// Count via summarize
range val from 1 to 5 step 1
| summarize count()
count
5

You can use the count expression via different types of aggregations. This will count per bucket.

range val from 1 to 5 step 1
| summarize count() by val
valcount
11
21
31
41
51

count

Counts the number of records in a group.

Syntax

count()

Used inside summarize.

Examples

Count log lines in the last hour:

logs
| where timestamp > ago(1h)
| summarize total = count()

Count per status:

requests
| where timestamp > ago(15m)
| summarize total = count() by statusCode
| order by total desc