# I want to add two numeric values and display in a dashboard

**URL:** <https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284>\
**Category:** Dashboard\
**Created:** [8 March 2023 09:46 UTC](https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284 "2023-03-08T09:46:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [8 March 2023 09:46 UTC](https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284/1 "2023-03-08T09:46:29Z")

</div>

This is the Debug Messsage and I would like to add the 2663.03774 and 3205.9554799999996 and show the value in a gauge

```auto
3/8/2023, 11:10:04 AMnode: Total DC Watts
sbfspot/2130438358 : msg.payload : Object
object
sbfspot/2130438237: 2663.03774
sbfspot/2130438358: 3205.9554799999996

```

This is what I tried but it does not work: Get a NaN message

```auto
3/8/2023, 11:45:03 AM[node: Total DC Watts](http://192.168.1.110:1880/#)sbfspot/2130438358 : msg.payload : number

NaN

```

This is my edit node

```auto
msg.payload = (msg.payload.sbfspot / 2130438237) + (msg.payload.sbfspot / 2130438358);
return msg;

```

---

<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:** [8 March 2023 10:12 UTC](https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284/2 "2023-03-08T10:12:40Z")

</div>

> [@fritserasmus](#):
>
> `msg.payload = (msg.payload.sbfspot / 2130438237) + (msg.payload.sbfspot / 2130438358);`

Since the properties have special characters you need to use the square bracket notation to access them, otherwise javascript interprets the `/` characters and divide symbols.

`msg.payload = msg.payload["sbfspot/2130438237"] + msg.payload["sbfspot/2130438358"]`

Edit, fixed the code, missing quotes.

---

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [8 March 2023 12:46 UTC](https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284/3 "2023-03-08T12:46:25Z")

</div>

> [@Colin](#):
>
> msg.payload = msg.payload[sbfspot/2130438237] + msg.payload[sbfspot/2130438358]

Thank you very much @Colin ,

In the end this is what works.

```auto
msg.payload = msg.payload["sbfspot/2130438237"] + msg.payload["sbfspot/2130438358"];

```

Thank you very much for helping me.

---

<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:** [22 March 2023 12:46 UTC](https://discourse.nodered.org/t/i-want-to-add-two-numeric-values-and-display-in-a-dashboard/76284/4 "2023-03-22T12:46:35Z")

</div>

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