# Nodered Math Handle

**URL:** <https://discourse.nodered.org/t/nodered-math-handle/21617>\
**Category:** General\
**Created:** [12 February 2020 20:49 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617 "2020-02-12T20:49:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thalesmaoa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thalesmaoa/32/17067_2.png) [@thalesmaoa](https://discourse.nodered.org/u/thalesmaoa)\
**Post date:** [12 February 2020 20:49 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617/1 "2020-02-12T20:49:30Z")

</div>

Hello, I've been looking over math capability inside NodeRed but can't find a suitable option.  
I need to perform a cumulative integral. Just want to know total energy generated during the day of PV panels.

Can' t find a way to do it.

I need to know past value to add to the actual value. When I try to place output to input it rejects.  
I also check [node-red-contrib-calc](https://github.com/bartbutenaers/node-red-contrib-calc) but there is no integral.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [12 February 2020 21:01 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617/2 "2020-02-12T21:01:16Z")

</div>

Have you had a look at [node-red-contrib-watt2kwh](https://flows.nodered.org/node/node-red-contrib-watt2kwh) (a shameless plug 😆)

---

<div class="post-metadata">

**Author:** ![thalesmaoa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thalesmaoa/32/17067_2.png) [@thalesmaoa](https://discourse.nodered.org/u/thalesmaoa)\
**Post date:** [13 February 2020 12:40 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617/3 "2020-02-13T12:40:12Z")

</div>

Nice, thank you! I will use it. For other purposes, is there a way to perform math operations that need past information?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 February 2020 14:12 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617/4 "2020-02-13T14:12:39Z")

</div>

> [@thalesmaoa](#):
>
> is there a way to perform math operations that need past information

Yes, you will need to save the earlier information in the node context. If you look at the docs about [writing functions](https://nodered.org/docs/user-guide/writing-functions) you will find lots of good stuff including how to save data in the node context so you can use it with a later message.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 February 2020 14:12 UTC](https://discourse.nodered.org/t/nodered-math-handle/21617/5 "2020-02-27T14:12:41Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
