Berserk Docs
Aggregate FunctionsStatistical

dcountif

Returns an estimate for the number of distinct values of the expression in the group, for which the predicate evaluates to true.

Syntax

dcountif(expr, predicate)

Parameters

Prop

Type

Returns: long

Syntax

dcountif(expr, predicate, accuracy)

Parameters

Prop

Type

Returns: long

Examples

Example 1 — Count distinct elite warriors

datatable(warrior:string, elite:bool)[
  "Ragnar", true,
  "Bjorn", true,
  "Floki", false,
  "Ragnar", true,
  "Harald", true
]
| summarize dcountif(warrior, elite)
dcountif_warrior (long)
3

Example 2 — With accuracy parameter, grouped by clan

datatable(warrior:string, elite:bool, clan:string)[
  "Ragnar", true, "Lothbrok",
  "Floki", false, "Lothbrok",
  "Harald", true, "Fairhair",
  "Bjorn", true, "Lothbrok",
  "Halfdan", false, "Fairhair"
]
| summarize dcountif(warrior, elite, 1) by clan
clan (string)dcountif_warrior (long)
Fairhair1
Lothbrok2

On this page