2 different flow show same result

Why these 2 different flow show same result in Price sensor. I think data is same in both function nodes “get count on reset”, but i don’t know how flow working and what i need to change ("ycount") or (msg.reset === 0) I am a new in NodeRed. Please help me.

// Grab the last saved total count:
msg.ycount = flow.get("ycount")||0;
// If the count just reset, display the old total:
if (msg.reset === 0) return msg;
// otherwise just update the new saved value,
else {
 flow.set("ycount", msg.payload);
 // and end the program:
 return null;


flow in NodeRed nomenclature is the whole automation contained by single tab.

flow variable is being shared for whole flow (all nodes available in the tab). If you have 2 automation paths, both defined in single NR flow, both make use of the same flow variable (ycount), overwriting it.

If you need both automation paths to be part of single flow, use different flow variables.
If those flows are not related (which is your usecase) make separate flows for each of them.

BTW, seeing repeatable code should be the signal to make a subflow from this and then reuse it