Adding up values with SUM node

I am trying load data from Excel, do some adding up and send it to other people.

Here is example input

Same data below but in JSON

[
  {
    "Task_ID": "SS-1",
    "Object_name": "Object-1",
    "Object_ID": "X-1",
    "Task_Started": 45281.521527778,
    "Task_Ended": 45299.5847222222,
    "Task_Name": "Name-1",
    "Task_Type": "Task",
    "Object_Address": "address-1",
    "Work_Unit": 1,
    "Work_Price": 26,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 26,
    "Op_type": "Other"
  },
  {
    "Task_ID": "SS-2",
    "Object_name": "Object-2",
    "Object_ID": "X-2",
    "Task_Started": 45294.465277778,
    "Task_Ended": 45295.49375,
    "Task_Name": "Name-2",
    "Task_Type": "Repair",
    "Object_Address": "address-2",
    "Work_Unit": 1,
    "Work_Price": 24,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 24,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-2",
    "Object_name": "Object-2",
    "Object_ID": "X-2",
    "Task_Started": 45294.465277778,
    "Task_Ended": 45295.49375,
    "Task_Name": "Name-2",
    "Task_Type": "Repair",
    "Object_Address": "address-2",
    "Work_Unit": "",
    "Work_Price": 0,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 0,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-3",
    "Object_name": "Object-3",
    "Object_ID": "X-3",
    "Task_Started": 45294.553472222,
    "Task_Ended": 45295.6784722222,
    "Task_Name": "Name-3",
    "Task_Type": "Other",
    "Object_Address": "address-3",
    "Work_Unit": 1,
    "Work_Price": 24,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 24,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-3",
    "Object_name": "Object-3",
    "Object_ID": "X-3",
    "Task_Started": 45294.553472222,
    "Task_Ended": 45295.6784722222,
    "Task_Name": "Name-3",
    "Task_Type": "Other",
    "Object_Address": "address-3",
    "Work_Unit": "0.25",
    "Work_Price": 9,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 9,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-4",
    "Object_name": "Object-4",
    "Object_ID": "X-4",
    "Task_Started": 45294.533333333,
    "Task_Ended": 45294.6861111111,
    "Task_Name": "Name-4",
    "Task_Type": "Repair",
    "Object_Address": "address-4",
    "Work_Unit": 1,
    "Work_Price": 24,
    "Material_Unit": 1,
    "Material_Price": 958.93,
    "Total_Price": 982.93,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-4",
    "Object_name": "Object-4",
    "Object_ID": "X-4",
    "Task_Started": 45294.533333333,
    "Task_Ended": 45294.6861111111,
    "Task_Name": "Name-4",
    "Task_Type": "Repair",
    "Object_Address": "address-4",
    "Work_Unit": 1,
    "Work_Price": 24,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 24,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-5",
    "Object_name": "Object-5",
    "Object_ID": "X-5",
    "Task_Started": 45294.410416667,
    "Task_Ended": 45294.7319444444,
    "Task_Name": "Name-5",
    "Task_Type": "Repair",
    "Object_Address": "address-5",
    "Work_Unit": 1,
    "Work_Price": 24,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 24,
    "Op_type": "Sale"
  },
  {
    "Task_ID": "SS-5",
    "Object_name": "Object-5",
    "Object_ID": "X-5",
    "Task_Started": 45294.410416667,
    "Task_Ended": 45294.731944444,
    "Task_Name": "Name-5",
    "Task_Type": "Repair",
    "Object_Address": "address-5",
    "Work_Unit": "",
    "Work_Price": 0,
    "Material_Unit": "",
    "Material_Price": 0,
    "Total_Price": 0,
    "Op_type": "Sale"
  }
]

Here is desired output.

Basically what I am trying to do is merge data based on field Task_ID

Where I am stuck is I don’t understand why Summarize note is not adding up 1 and 0.25. It returns 1 as a result where it should be 1.25

I can see it sums up 1+1 correctly so there is something going on with float numbers I guess.

By the way I have not worked out all workflow yet. I would at least like to ask for community help to understand what is happening with SUM node.

Information on your n8n setup

  • n8n version: 1.29.1

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Tom_M

That’s because the field Work_Unit may be a string or a number
image
image

Here is the fix

1 Like

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