I have a raw variable which is continuously increasing (until it eventually overflows and restarts at 0). It’s similar to a water meter that generates pulses.

What I would like to create is a new synthetic variable, which contains one value each day, and each value is equal to *pulse count at midnight - yesterday’s pulse count at midnight*. Then I want to display this as a chart on my dashboard, so that users can see daily totals.

I’m sending the data every 30 seconds, with Ubidots industrial, but I don’t want to depend on assuming that all the data is there, because there could be network interruptions. Therefore I don’t want to use shift to step back over a day’s worth of data.

Here is a simple example, [SOLVED] Creating a synthetic variable for pulse counter sensors but my goal is to go farther than this, and create a very sparse time series with only 1 value for each day, where each value represents the total number of pulses in a day (doing this by month and year is also a goal of mine).

Here is my first guess at an expression, where var1 is the raw variable that is the pulse count. I am ignoring the overflow condition. Will this run every day at midnight, and be timestamped to midnight?

last(var1,‘1D’) - min(var1,‘2D’)

will these three always produce the same result, due to the fact that data_range is 1D?:

last(var1,‘1D’)

max(var1,‘1D’)

min(var1,‘1D’)

On the Synthetic Variables Basics page, https://help.ubidots.com/user-guides/analytics-synthetic-variables-basics

I have the following question regarding the offset example (“A = sum(raw_variable, “8H”, offset=6)”). Is offset required to be positive, and is offset required to be an integer?