count() (aggregation function)

Counts the number of records per summarization group, or total if summarization is done without grouping.

Use the countif aggregation function to count only records for which a predicate returns true.

Note

This function is used in conjunction with the summarize operator.

Syntax

count()

Returns

Returns a count of the records per summarization group (or in total, if summarization is done without grouping).

Example

This example returns a count of events in states starting with letter W:

StormEvents
| where State startswith "W"
| summarize Count=count() by State

Output

State Count
WEST VIRGINIA 757
WYOMING 396
WASHINGTON 261
WISCONSIN 1850