Commercial operations and calculations
Calculate line-item margins
Calculates revenue, cost, margin and margin percentage per line item.
Available recipeIncludes configuration, sample data and tests
Make it your own
Review the setup and limits below, then open an editable copy in Turbyn.
Use this recipeYour selection stays with you through signup.
What it does
Discount-adjusted revenue minus extended cost.
What to customize
Set decimal precision.
Run the included tests with your configuration and mappings. Review success, missing-input and failure results before publishing.
Expected outcome
This included example runs in dry-run mode with synthetic data. Integration tests separately cover provider responses using test doubles. It is not a live customer result.
Sample input
sample-input.json
{
"inputFields": {
"field1": "{\"items\":[{\"sku\":\"A\",\"price\":100,\"cost\":60,\"quantity\":2}]}"
}
}Sample output
sample-output.json
{
"outputFields": {
"output1": "ok",
"output2": "1",
"output3": "[{\"sku\":\"A\",\"revenue\":200,\"cost\":120,\"margin\":80,\"marginPct\":40}]"
}
}Returned fields
- output1
- ok or error
- output2
- item count
- output3
- margin rows JSON
What changes when it runs
Reads JSON line items; no external writes.
Ready to try it with your rules?
Map your inputs, test a sample and publish the version you’ve checked.