0

Aggregate from Start of Day to Current Time

How do you write an equation for an aggregate function that spans a period from the start of the DAY up to the current time.

When I try something like this below
Delta('[Product Counter Example]', '1D', 'DAY')
 

I get the error "Error evaluating expression: Exception occurred while getting queue value"

I have searched in the documentation, but an example of something like this would be helpful.

The purpose of this is to evaluate every 5 minutes the number of production units a single production line has produced since the start of the day.

3 replies

null
    • damon_vinciguerra.1
    • 2 mths ago
    • Reported - view

    john. patanian interestingly, when I run your analytic, I don't get an error, just, nothing happens. Maybe that's an issue with v24. I'm guessing you're on v23?

    I was able to get a value from the below expression:

    Delta('[localhost.Data Generation.Accumulate 0001]', '' + DurationSinceDateTime('DAY') / 1000 +'s' , 'DAY')

    I'm using dummy data, so I'm not 100% sure it works, but it's updating when I hit evaluate. Potentially you're issue is that DAY+1D is always in the future. But, I could be wrong.

    • john_patanian
    • 2 mths ago
    • Reported - view

    Here is what I got to work:
        Delta('[Site.%Asset%.Products Packed]', DurationSinceDateTime('Day'), 'Day')

    The issue was if that I put 'D' in where I have DurationSinceDateTime function, it was trying to look into the future.  

    Above seems to work well consistently.  Would work similarly for Hour or month as well.

    What led me to this was the "Canary Calculations 201" Video.  My recommendations would be to have an example like this more readily available as a How To or somewhere in the documentation.

      • smason
      • 2 mths ago
      • Reported - view

      john. patanian You could also use the ResettingAnchoredInterval function. It will build the aggregate interval through the time period then reset once the new time period begins. In your example, you would use ResettingAnchoredInterval('Delta', '[tag]', '1d') then have your calc trigger periodically every 5 minutes.

      This article contains a json file which you can import into your Canary environment when you open the Calc & Events tile if you want to see an example of each function. There are a few How To's but it is by no means exhaustive. https://helpcenter.canarylabs.com/t/x2y8gla/available-functions-of-the-calculation-server-version-24

Content aside

print this pagePrint this page
  • 2 mths agoLast active
  • 3Replies
  • 40Views
  • 3 Following