Berserk Docs
Aggregate FunctionsStatistical

countif

Returns a count of the records for which a predicate is true.

Syntax

countif(predicate)

Parameters

Prop

Type

Returns: long

Examples

Example 1

datatable(warrior:string, voyages:long)[
  "Ragnar", 42,
  "Bjorn", 31,
  "Lagertha", 28,
  "Ivar", 35,
  "Floki", 12
]
| summarize countif(voyages > 30)
countif_ (long)
3

Example 2

datatable(warrior:string, voyages:long, weapon:string)[
  "Ragnar", 42, "axe",
  "Bjorn", 31, "sword",
  "Ivar", 35, "axe"
]
| summarize countif(voyages > 30) by weapon
weapon (string)countif_ (long)
axe2
sword1

On this page