count() (aggregation function)

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.

[!INCLUDE data-explorer-agg-function-summarize-note]

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

StateCount
WEST VIRGINIA757
WYOMING396
WASHINGTON261
WISCONSIN1850