Tools > Set multiple variables returns formula as text or empty instead of calculated numeric value

:bullseye: What is your goal?

I need to calculate numeric values for Shopify order line items before writing them to Google Sheets.

Scenario flow:

Google Sheets Search Rows
→ Shopify Get an order
→ Iterator over Shopify line items
→ Google Sheets Search Rows to find product costs
→ Tools > Set multiple variables
→ Google Sheets Add a Row

For each line item, I need to calculate:

  1. line_revenue_net_calc
  2. total_cost_net_calc
  3. estimated_margin_net_calc

Example expected values for one line item:

Quantity = 1
Discounted unit price = 209.00
VAT rate = 22
Unit cost net = 105.40

Expected output:

line_revenue_net_calc = 171.31
total_cost_net_calc = 105.40
estimated_margin_net_calc = 65.91

Then I want to map these numeric values into Google Sheets.

:thinking: What is the problem & what have you tried?

The scenario works end-to-end. The issue is only inside Tools > Set multiple variables.

At first, when I entered formulas such as:

round((Quantity * Discounted unit price) / (1 + vat_rate / 100); 2)

Make returned the formula as plain text, for example:

round((1 * 209.0) / (1 + 22 / 100); 2)

instead of returning the calculated number.

Then I rebuilt the formulas using mapped pills from previous modules. After that, the output became empty for the calculated variables.

Current formulas are built with mapped fields:

line_revenue_net_calc:
round((Quantity * Discounted unit price after all discounts: Amount) / (1 + vat_rate / 100); 2)

total_cost_net_calc:
round(Quantity * unit_cost_net; 2)

estimated_margin_net_calc:
round(((Quantity * Discounted unit price after all discounts: Amount) / (1 + vat_rate / 100)) - (Quantity * unit_cost_net); 2)

The mapped fields come from:

  • Iterator module: Quantity
  • Iterator module: Discounted unit price after all discounts: Amount
  • Google Sheets Product_Costs lookup: vat_rate
  • Google Sheets Product_Costs lookup: unit_cost_net

Important detail:
unit_cost_net comes from Google Sheets and may use comma decimal format, for example 105,40.

I also tested a simple variable:

test_calc = round(10 / 3; 2)

This returned 3, not 3.33.

So I am not sure if:

  • I am using the wrong syntax for round()
  • Set multiple variables does not evaluate formulas the way I expect
  • Google Sheets formatted numbers / comma decimals are causing the output to become empty
  • I need to convert mapped values to numbers before calculating
  • I should use a different module for these calculations

:clipboard: Error messages or input/output bundles

There is no scenario error. The modules are green.

But Tools > Set multiple variables output is wrong.

Previous output example:

line_revenue_net_calc:
round((1 * 209.0) / (1 + 22 / 100); 2)

total_cost_net_calc:
round(1 * 105,40; 2)

estimated_margin_net_calc:
round(((1 * 209.0) / (1 + 22 / 100)) - (1 * 105,40); 2)

After rebuilding the formulas with mapped fields, the output became:

line_revenue_net_calc: empty
total_cost_net_calc: empty
estimated_margin_net_calc: empty

Expected output:

line_revenue_net_calc: 171.31
total_cost_net_calc: 105.40
estimated_margin_net_calc: 65.91 What is the correct way to calculate these numeric values in Make?

Should I use a specific function to convert Google Sheets formatted values like 105,40 into numbers?

Should the formulas be written differently inside Tools > Set multiple variables?

Or is there a better module/approach for doing these calculations before adding the row to Google Sheets?

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hi, with regards to your attached screenshot, use the native math operators, instead of like putting asterisk and forward slash.

All the Best,

-John