How to convert negative result to zero using expression with SET Node

#help I want to subtract two field using set node but if result is negative then i want to make the result as 0 . if result is positive then don’t want to make any changes.
can i do that with one set node itself using expression without using expression

{
  "nodes": [
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "Value",
              "value": "={{$json["Amount1"]-$json["Amount2"]}}"
            }
          ]
        },
        "options": {
          "dotNotation": false
        }
      },
      "name": "Set2",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        720,
        1120
      ]
    }
  ],
  "connections": {}
}

You can use Math.max with value 0: {{ Math.max($json['Amount1']-$json['Amount2'],0) }}

1 Like

Thanks it worked