# How to multiply 2 data points and graph the product?

**URL:** https://forums.losant.com/t/how-to-multiply-2-data-points-and-graph-the-product/426
**Category:** Help
**Created:** [February 28, 2017, 5:16pm UTC](https://forums.losant.com/t/how-to-multiply-2-data-points-and-graph-the-product/426 "2017-02-28T17:16:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Winston\_Ford](https://avatars.discourse-cdn.com/v4/letter/w/4491bb/32.png) [@Winston\_Ford](https://forums.losant.com/u/Winston_Ford)
#### Post date: [February 28, 2017, 5:16pm UTC](https://forums.losant.com/t/how-to-multiply-2-data-points-and-graph-the-product/426/1 "2017-02-28T17:16:26Z")

</div>

Enjoying the Losant platform. I have a dashboard [https://app.losant.com/#/dashboards/58a1d23e50530f0001031a34](https://app.losant.com/#/dashboards/58a1d23e50530f0001031a34)

As you might see, I am logging volts, milliamps, and temp. I am graphing temp. I would like to graph temp vs watts. How might I multiply the volts x amps and add to the graph? I can do this swiftly in google spreadsheets, but scratching my head with Losant!

Thanks!  
Winston

---

<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 1, 2017, 6:36pm UTC](https://forums.losant.com/t/how-to-multiply-2-data-points-and-graph-the-product/426/2 "2017-03-01T18:36:42Z")

</div>

You’ll want to use a workflow to calculate watts and store that value on another attribute on your device. Steps are …

1. Create a new [attribute](https://docs.losant.com/devices/overview/#device-attributes) on your device(s) called “watts”. The attribute type should be “number”.
2. Create a [new workflow](https://docs.losant.com/workflows/overview/) in the same application as the devices.
3. Add a [Device Trigger node](https://docs.losant.com/workflows/triggers/device/), which will fire the workflow every time the specified device(s) reports state.
4. Connect the trigger to a [Conditional node](https://docs.losant.com/workflows/logic/conditional/) and set the condition to be `{{ data.watts }} === undefined`. (More on why we’re doing this below.)
5. Connect the positive output of the Conditional node to a [Math node](https://docs.losant.com/workflows/logic/math/). In here, you can pull milliamps and voltage off your payload and do the calculation to convert that to watts. Then, store the result on your payload at `data.watts`.
6. Connect the Math node to a [Device State node](https://docs.losant.com/workflows/outputs/device-state/). Use the ID of the device that reported state (available on the payload) and report the wattage that you calculated in the previous step under your new “watts” attribute on the device.

The reason for the conditional node is that, when we report the device state in our final node, this will cause the workflow to trigger again. We are checking to see if `watts` is not on the payload so we can tell the difference between an actual device state report and our calculated report. Without this check, the workflow will throw an “infinite loop” error.

---

<div class="post-metadata">

### Author: ![Winston\_Ford](https://avatars.discourse-cdn.com/v4/letter/w/4491bb/32.png) [@Winston\_Ford](https://forums.losant.com/u/Winston_Ford)
#### Post date: [March 2, 2017, 4:07pm UTC](https://forums.losant.com/t/how-to-multiply-2-data-points-and-graph-the-product/426/3 "2017-03-02T16:07:22Z")

</div>

Thanks for workin thru that one Dylan.
