AnsweredAssumed Answered

Totalizing Sampled Values using DataLink

Question asked by vwitzel on Oct 5, 2016
Latest reply on Oct 6, 2016 by Roger Palmen

Hi all,


I am working on a DataLink report that is supposed to show instantaneous daily readings and weekly, monthly, and yearly rollups. For the daily readings, we are grabbing the value archived prior to a hard-coded timestamp on the day chosen by the user. For the rollup reports, I would like to totalize values that are sampled at the same time every day over the time period chosen by the user. I tried using DataLink's "total" (time-weighted) Calculated Data function for this purpose, but found the result to differ from what I was looking for.

For example, below are sampled values for a tag for the last 7 days:


When I use the "total" (time-weighted) function over the same time frame (see function below), the result is different (191,264.86). My understanding is that that is because this function calculates the integral (area under the curve) over the specified time period, which mathematically speaking, isn't the same as summing the samples. That being said, is there a way to accomplish the latter using DataLink functions?


PiAdvCalcData([tag name],"28-Sep-16 9:15 AM","5-Oct-16 9:15am","total", "time-weighted",0,1,0,[server name])