Calculation in API to send data to DB

I’m trying to figure out how to perform a calculation on a table or data type either as it’s being added to the database or just afterward. The data is currently uploaded to the DB using an API Endpoint so I’d like to add this calculation to that same endpoint.

The calculation I’d like to perform takes a single data point from the new data, a date, extracts the month and performs a simple subtraction and a division with it. I can create this value on the page using Toolbox Expression or Math.js but it reduces the page speed since I’m doing it against a large range of data, a couple hundred records. Adding it to the database it gets done only once.

This is what the working formula looks like in the Math.js element. Input A’s value is the date:

Couldn’t you send the inputs value as a key parameter into the backend workflow and set this calculation up in the backend workflow, or is it that the brackets will not function in a normal expression in bubble?

I’m actually not even sure the brackets are needed and you could just do the calculation in your backend workflow.

I cannot answer the question about sending the inputs. It’s why I’m posting here, I’m not certain how, or if, I can do this at all. As for the brackets, I also don’t know if that’s possible in a backend workflow although I suppose it could be a two step process instead of a single one with brackets…that is, if brackets cannot be used in the API. I’m open to getting a better understanding of this, maybe see an example where it’s used.

In the case I’ve demonstrated on the page using Math.js, the brackets are needed. The order of operations needs to be preserved in order to get the result I’m looking for.