Date range
Ubidots allows you to build new variables from a time series based on date range data, i. e, calculate mean, sum, median per hour, per day, etc., using a synthetic variable based on your sensor inputs
Below you can find the commonly used date range functions.
Function
Description
​
max(x,range)max(x, range)
​
Returns the maximum value of the variable x in the specified date range.
​
min(x,range)min(x, range)
​
Returns the minimum value of the variable x in the specified date range.
​
mean(x,range)mean(x, range)
​
Returns the mean value of the variable x in the specified date range.
​
std(x,range) std(x, range)
​
Returns the standard deviation of the variable x in the specified date range.
​
count(x,range)count(x, range)
​
Returns the number of dots stored in the variable x for the specified date range.
​
last(x,range)last(x, range)
​
Returns the last value of the time-series variable x in the specified date range.
​
first(x,range)first(x, range)
​
Returns the first value of the time-series variable x in the specified date range.
​
sum(x,range)sum(x, range)
​
Returns the sum of the dots stored in the variable x in the specified date range.
Date Range functions have the following syntax:
aggregation_method(<variable>,<range>,<position>,<offset> )
Parameters
Description
Value
Mandatory
Variable
It shows the measurements of a sensor as a time series of data points that vary over time, also known as "dots", and is identified by a variable label.
Variable label
YES
Range
Time window the function will be computed within.
NOTE: The selected range should be set in a way that evenly divide the next range. For example, if using minutes ("T"), whatever the number n is, it has to evenly divide an hour ("H"). Available values for minutes are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30. Other values may render unexpected results. Same applies to other ranges.
Available data ranges:
"nT" : Every n minutes,
"nH" : Every n hours,
"nD" : Every n days,
"W" : Every end of week,
"M" : Every end of month
YES
Position
Indicates whether the output value will be timestamped at the start of the time series or at the end.
position ="start" or position = "end"
NO
Offset
Sets the hour at which our synthetic variable engine will begin to compute the variable, which is the number of hours after midnight. By default is 0 hours.
Any integer between 1 and 23
NO
Last modified 7mo ago
Copy link