Redigera

Dela via


percentrank_tdigest()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Calculates the approximate rank of the value in a set, where rank is expressed as a percentage of the set's size. This function can be viewed as the inverse of the percentile.

Syntax

percentrank_tdigest(digest, value)

Learn more about syntax conventions.

Parameters

Name Type Required Description
digest string ✔️ An expression that was generated by tdigest() or tdigest_merge().
value scalar ✔️ An expression representing a value to be used for percentage ranking calculation.

Note

The type of value and the type of the elements in digest should be the same.

Returns

The percentage rank of value in a dataset.

Examples

Getting the percentrank_tdigest() of the damage property that valued 4490$ is ~85%:

StormEvents
| summarize tdigestRes = tdigest(DamageProperty)
| project percentrank_tdigest(tdigestRes, 4490)

Output

Column1
85.0015237192293

Using percentile 85 over the damage property should give 4490$:

StormEvents
| summarize tdigestRes = tdigest(DamageProperty)
| project percentile_tdigest(tdigestRes, 85, typeof(long))

Output

percentile_tdigest_tdigestRes
4490