# Expression support

**URL:** https://forums.losant.com/t/expression-support/2401
**Category:** Feature Request
**Tags:** devices
**Created:** [November 22, 2019, 6:21pm UTC](https://forums.losant.com/t/expression-support/2401 "2019-11-22T18:21:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)
#### Post date: [November 22, 2019, 6:21pm UTC](https://forums.losant.com/t/expression-support/2401/1 "2019-11-22T18:21:32Z")

</div>

I like the new feature “expressions in time series graph”.  
Would really like to see it as an option in the device attribute definition though, because if I do any kind of other reporting on the raw time series data, I would need to scale it somewhere.

---

<div class="post-metadata">

### Author: ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)
#### Post date: [November 22, 2019, 7:00pm UTC](https://forums.losant.com/t/expression-support/2401/2 "2019-11-22T19:00:40Z")

</div>

Hi @Lars_Andersson,

I will create a Feature Request for this functionality, and update you should it be implemented in the future!

Thanks,  
Julia

---

<div class="post-metadata">

### Author: ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)
#### Post date: [March 19, 2021, 3:49pm UTC](https://forums.losant.com/t/expression-support/2401/3 "2021-03-19T15:49:24Z")

</div>

As an additional request, it would be nice to be able to apply math to multiple time series data points.  
Let’s say Voltage and Current are measured, but I want to graph Voltage ,Current but also a calculated value of Power in the same graph.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [March 19, 2021, 5:51pm UTC](https://forums.losant.com/t/expression-support/2401/5 "2021-03-19T17:51:19Z")

</div>

I like that request - where an time series block expression can reference values returned in other segments - but it will take some time to deliver that. There are a lot of gotcha’s there around, for example, knowing which point in a series to reference (by ID? by index? by same timestamp?)

There is an alternative, one we have suggested multiple times to other users over the years, and that is to use a workflow to calculate Power and apply it as a new attribute at the same timestamp that Voltage and Current were reported.

Attached is an application export bundle that illustrates this. It has:

- A device with number attributes `Current`, `Voltage`, and `Power`
- A workflow that fires whenever the device reports state for the `Current` or `Voltage` attributes

That workflow multiplies the two state values and records `Power` back on device state at the same timestamp.

[export-6054de9d020e5a0007aaddf5-1616175871340-currentVoltagePower.zip](https://forums.losant.com/uploads/short-url/lBhMSJAkLTuAgSkQmbfVz1HUCzI.zip) (2.4 KB)

To test it:

1. Import this bundle into any of your applications.
2. Visit the detail page of the device included. (It’s called “Device”.)
3. In the top right corner, open the “Device Actions” dropdown and select “Force State”.
4. Select “Current” in the first row’s first input and enter a number in the second input.
5. Select “Voltage” in the next row that appears, and enter a number alongside it.
6. Click “Force Report State”.

In the device live log, you will see two entries: One for the force report you just made, and another for the workflow calculating Power. If you refresh your browser and check the device’s recent state logs in the right panel, you’ll see Power reported at the same time as the other attributes.

---

<div class="post-metadata">

### Author: ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)
#### Post date: [March 22, 2021, 12:22pm UTC](https://forums.losant.com/t/expression-support/2401/6 "2021-03-22T12:22:33Z")

</div>

yeah, that’s how I’m currently doing it.

---

<div class="post-metadata">

### Author: ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)
#### Post date: [August 3, 2021, 5:59pm UTC](https://forums.losant.com/t/expression-support/2401/8 "2021-08-03T17:59:13Z")

</div>

To answer your question above “which point in a series to reference”, would be the timestamp for me.
