count() (aggregation function)
Learn how to use the count() function to count the number of records in a group.
Counts the number of records per summarization group, or total if summarization is done without grouping.
To only count records for which a predicate returns true, use countif().
Syntax
count()
Returns
Returns a count of the records per summarization group, or in total if summarization is done without grouping.
Example
The following 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
- Aggregation function types at a glance
- countof()
- countif() (aggregation function)
- count_distinct() (aggregation function)
- bin_at()
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.