count() (aggregation function)
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 |
... | ... |
Related content
- bin_at() rounds values down to a fixed-size bin, which can be used to aggregate data, such as by time unit.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for