percentrank_tdigest()
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(TDigest, Expr)
Arguments
- TDigest: Expression that was generated by tdigest() or tdigest_merge().
- Expr: Expression representing a value to be used for percentage ranking calculation.
Returns
The percentage rank of value in a dataset.
Tips
The type of second parameter and the type of the elements in the
tdigestshould be the same.First parameter should be TDigest that was generated by tdigest() or tdigest_merge()
Examples
Getting the percentrank_tdigest() of the damage property that valued 4490$ is ~85%:
StormEvents
| summarize tdigestRes = tdigest(DamageProperty)
| project percentrank_tdigest(tdigestRes, 4490)
| 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))
| percentile_tdigest_tdigestRes |
|---|
| 4490 |