merge_tdigest()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Merges tdigest results (scalar version of the aggregate version tdigest_merge()).

Read more about the underlying algorithm (T-Digest) and the estimated error here.

The merge_tdigest() and tdigest_merge() functions are equivalent

Important

The results of tdigest() and tdigest_merge() can be stored and later retrieved. For example, you may want to create daily percentiles summary, which can then be used to calculate weekly percentiles. However, the precise binary representation of these results may change over time. There's no guarantee that these functions will produce identical results for identical inputs, and therefore we don't advise relying on them.

Syntax

merge_tdigest(exprs)

Learn more about syntax conventions.

Parameters

Name Type Required Description
exprs dynamic ✔️ One or more comma-separated column references that have the tdigest values to be merged.

Returns

The result for merging the columns *Expr1*, *Expr2*, ... *ExprN* to one tdigest.

Example

range x from 1 to 10 step 1 
| extend y = x + 10
| summarize tdigestX = tdigest(x), tdigestY = tdigest(y)
| project merged = merge_tdigest(tdigestX, tdigestY)
| project percentile_tdigest(merged, 100, typeof(long))

Output

percentile_tdigest_merged
20