round
Description
Returns a number rounded to the nearest integer or to a specified number of decimal places. For example, 1.5 becomes 2 and 8.1 becomes 8.
Syntax
Like many functions in DataPrime, round supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| number | number | true | The value to round |
| digits | number | false | Number of decimal places to round to. Defaults to 0 (whole numbers) |
Example
Use case: Round averages for discrete counts
Compute the average number of online users and round to a whole number for clarity. Example: 569.5 becomes 570.
Use case 2: Round latency values for readability
When analyzing traces, average latency values may have long decimal places. Use round with 2 digits for cleaner results.
Example data
{
"total_users_online": 1093
},
{
"total_users_online": 942
},
{
"total_users_online": 120
},
{
"total_users_online": 123
}
Example query
Example output
Theme
Light