0
votes

Objective: Count all columns where values < 0. Columns could be either positive or negative

Example as shown:

Table
| summarize count() by Field
| where (Col1 <0 or Col2 <0 or Col3 <0 or Col4 <0)

The result I get back is:

A | 1
B | 1
C | 0

New to Kusto - what am I doing wrong?

Thanks

1

1 Answers

1
votes

try reversing the order of the filter and the aggregation, i.e.:

Table
| where (Col1 <0 or Col2 <0 or Col3 <0 or Col4 <0)
| summarize count() by Field

or use the countif() aggregation function:

Table
| summarize countif(Col1 <0 or Col2 <0 or Col3 <0 or Col4 <0) by Field