Sum with a condition

Inside an experience workflow, is it possible to get the sum of all values in a time range with a condition?


  • I have a device, sending a value X and a value Y every hour;
  • By accessing an endpoint, the experience page shows me the sum of all X in a month (a simple gauge query with a time range);
  • I want it to show me the sum of all X everytime Y was a specific value (Y< 1,0 for example)

A few issues i’ve encountered:

  • A simple Conditional Node wouldn’t work, because the trigger is the endpoint, so it would check the Y value just once. Not sure if a Loop node would solve this problem;
  • In a regular workflow, a timer+conditional+gauge and a storage set would be enough, but there’s no timer in an experience workflow;
  • I believe a Function Node would do the trick, but i’m trying to be as didactic as possible with this application, so it’s better if other nodes are able to perform what I want.

Any simple possibilities i’m missing?
Appreciate the help!

There isn’t an easy way to accomplish this for data that has already been reported. However, going forward, you could start saving a new attribute (i.e. “xWhenYMeetsCondition”) on the device whenever it reports state and only record that value when your conditions are met. You can then view these values in a relevant dashboard block. Here’s a basic sequence of nodes that would facilitate that:

Let us know how it goes, or if you have any questions!

1 Like

Excellent advice, Sebastian!
I made something like this:
and it seems to be doing the trick.

Thanks for helping, and please let me know if I’ll run into any trouble that i’m not seeing right now :smile: