Add values from MQTT

Hi,
I want to do some calculations with the values i receive from MQTT.
The "convert functions" converts the string, coming from the MQTT, to a number.

msg.payload = Number(msg.payload);
return msg;

mqtt

What i want to do is : subtract the number that is coming from MQTT "rem/rechts" with the number that is comming from MQTT "rem/links" this result must be devided by MQTT "rem/links" and multiplied by 100 => the result is the difference between MQTT "rem/rechts" and "rem/links" in %.

thanks for your help :wink:

To do that calculation you need both values in a single message that you then pass to your Function node. This recipe in the cookbook shows how you can do that: https://cookbook.nodered.org/basic/join-streams

Thx knolleary for your answer, ...
I tried your suggestion to merge (join) both values, but i could't manage to get any message out of the function.
I did found a solution => I used variables instead to store the values.

Thanks and greets :wink: