Ubidots Community

Running a Synthetic Variable After a Specific Date

Hello, I am creating a synthetic variable that calculates the daily runtime of a piece of equipment (related to this question Calculating Machine On Time Using Synthetic Variables and Gauges - #2 by Leonardo_Castellanos) but I only want the sum function to calculate daily sums AFTER a specific date.

For example, if I have continuous data since November 2022, but I only want the synthetic variable to process data After January 1, 2023, how can I incorporate this into my code? I assume it is using a where statement, but I have tried a few attempts, and they don’t seem to be working as intended.

I am using a variation of the sum(variable, “1D”) function combined with a few where statements to incorporate various thresholds when calculating the daily runtime totals.

Thank You!

Greetings @qntfy, hope you are doing great!

Regarding your question, it is not possible to specify a start date for a synthetic variable calculation. The Synthetic Variables engine always calculates taking the complete historical dataset as input.

I would recommend the following alternative: simply deleting the values from the synthetic variable prior to whatever start date you required. This recommendation applies only if you don’t need the data previous to the date that you want to start the calculation from.

Best regards.