Best Practice: Add a count() to groupBy() results when using collect()
When using the groupBy()
function without a
function=
argument, queries
include a count()
function by default. As a result,
the results of the query automatically include a
_count
field that displays the
total count for each aggregation. However, once a
function=
argument is added, the
count()
function is no longer included in the
results.
To include the count()
function, you must add it
into an array:
groupBy(ComputerName, function=[collect(DomainName), count()])
The results now include count() and look like this:
![]() |