We have accumulative value and we want to take Delta for this accumulative value at end of each hour. For example value at start of the hour is 100 and at the end of the hour it is 150, so Delta is 50 for this specific hour. How we can use calculation tag option to achieve it?

First create a String Tag called DateTime with the Data Source of DateTimeString.

Next create a Double Tag called InitialValue with the Data Source of Calculation and the following Calculation.

IF(SUBSTR([DateTime.Value],STRLEN([DateTime.Value])-5,5) = “00:00”,[SourceTag.Value],[InitialValue.Value])

Then you have a second Double Calculation Tag called TheDifference with the following Calculation.

[SourceTag.Value]-[InitialValue.Value]

A third Calculation Tag called LastHour can be used to hold the last hour’s result.

IF(SUBSTR([DateTime.Value],STRLEN([DateTime.Value])-5,5) = “59:59”,[TheDifference.Value],[LastHour.Value])