Training
Module
Write multi-table queries by using Kusto Query Language - Training
Learn how to write Kusto Query Language (KQL) queries to combine and retrieve data from two or more tables by using the `lookup`, `join`, and `union` operators.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Table.MaxN(table as table, comparisonCriteria as any, countOrCondition as any) as table
Returns the largest row(s) in the table
, given the comparisonCriteria
. After the rows are sorted, the countOrCondition
parameter must be specified to further filter the result. Note the sorting algorithm cannot guarantee a fixed sorted result. The countOrCondition
parameter can take multiple forms:
countOrCondition
items in ascending order is returned.Find the row with the largest value in column [a] with the condition [a] > 0, in the table. The rows are sorted before the filter is applied.
Usage
Table.MaxN(
Table.FromRecords({
[a = 2, b = 4],
[a = 0, b = 0],
[a = 6, b = 2]
}),
"a",
each [a] > 0
)
Output
Table.FromRecords({
[a = 6, b = 2],
[a = 2, b = 4]
})
Find the row with the largest value in column [a] with the condition [b] > 0, in the table. The rows are sorted before the filter is applied.
Usage
Table.MaxN(
Table.FromRecords({
[a = 2, b = 4],
[a = 8, b = 0],
[a = 6, b = 2]
}),
"a",
each [b] > 0
)
Output
Table.FromRecords({})
Training
Module
Write multi-table queries by using Kusto Query Language - Training
Learn how to write Kusto Query Language (KQL) queries to combine and retrieve data from two or more tables by using the `lookup`, `join`, and `union` operators.