Redigera

Dela via


count() (aggregation function)

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

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

Null values are ignored and don't factor into the calculation.

To only count records for which a predicate returns true, use countif().

Note

This function is used in conjunction with the summarize operator.

Syntax

count()

Learn more about syntax conventions.

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:

StormEvents
| summarize Count=count() by State

Output

State Count
TEXAS 4701
KANSAS 3166
IOWA 2337
ILLINOIS 2022
MISSOURI 2016
GEORGIA 1983
MINNESOTA 1881
WISCONSIN 1850
NEBRASKA 1766
NEW YORK 1750
... ...
  • bin_at() rounds values down to a fixed-size bin, which can be used to aggregate data, such as by time unit.