Calculate the order value

Completed

Each line item's value is Unit Price × Quantity, and the order's total is the sum across all line items. In this unit, the flow tallies that total into a variable.

  1. Select (+) below List Order Details, search for Initialize variable, and add it.

  2. Rename the action to Init Order Value and configure it:

    • Name: Order Value
    • Type: Float
    • Value: 0

    Float suits fractional currency values, and starting at 0 guarantees a correct total.

    Screenshot initializing the order value variable.

  3. Select (+) below Init Order Value, search for Apply to each, and add it.

  4. Rename the loop to Calculate Order Value. In Select an output from previous units, select the lightning bolt and choose List of items under List Order Details.

    Screenshot showing the Apply each loop with List of items from List Order Details selected as its input.

  5. Select (+) inside the loop, search for Increment variable, and add it.

  6. Rename the action to Increment Order Value. In Name, select Order Value.

    Screenshot showing the Increment Order Value action with the Order Value variable selected.

  7. In Value, open the expression editor (fx) and add the line item calculation. Either paste this expression directly:

    mul(item()?['nwind_quantity'], item()?['nwind_unitprice'])
    

    Or, in the modern designer, select Create an expression with Copilot and enter this prompt, then select Create expression and confirm the result matches the expression above:

    Multiply unit price by quantity
    

    Screenshot showing the expression editor with the multiply unit price prompt in the text box.

  8. Select Add to accept the expression, then Save draft.

Cloud flow expressions use Power Automate expression functions such as mul(), similar in spirit to Excel formulas. The pasted expression works in either designer.

✅ Checkpoint: Calculate Order Value loops over List of items and contains Increment Order Value with the mul() expression. After the loop runs, Order Value holds the full value of the order.

Screenshot showing the completed Calculate Order Value loop containing the increment action.