# Percent calculation

**URL:** <https://discourse.nodered.org/t/percent-calculation/25309>\
**Category:** General\
**Created:** [22 April 2020 15:05 UTC](https://discourse.nodered.org/t/percent-calculation/25309 "2020-04-22T15:05:37Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 April 2020 15:59 UTC](https://discourse.nodered.org/t/percent-calculation/25309/4 "2020-04-22T15:59:45Z")

</div>

Hi @Cedric

The Function node you have shared assumes you have already put the two values into flow context before the Function is triggered.

If you are getting `NaN` then one or both of your values is probably not set properly.

Can you share your wider flow that shows how `income` and `outgoing` are set in context, and how you are triggering this Function node?

---

_[View the full topic](https://discourse.nodered.org/t/percent-calculation/25309)._
