around() function
Learn how to use the around() function to indicate if the first argument is within a range around the center value.
Creates a bool value indicating if the first argument is within a range around the center value.
Syntax
around(value,center,delta)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | int, long, real, datetime, or timespan | ✔️ | The value to compare to the center. |
| center | int, long, real, datetime, or timespan | ✔️ | The center of the range defined as [(center-delta) .. (center + delta)]. |
| delta | int, long, real, datetime, or timespan | ✔️ | The delta value of the range defined as [(center-delta) .. (center + delta)]. |
Returns
Returns true if the value is within the range, false if the value is outside the range.
Returns null if any of the arguments is null.
Example: Filtering values around a specific timestamp
The following example filters rows around specific timestamp.
range dt
from datetime(2021-01-01 01:00)
to datetime(2021-01-01 02:00)
step 1min
| where around(dt, datetime(2021-01-01 01:30), 1min)
Output
| dt |
|---|
| 2021-01-01 01:29:00.0000000 |
| 2021-01-01 01:30:00.0000000 |
| 2021-01-01 01:31:00.0000000 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.