logo
search
Others

How to Subtract SharePoint List Quantities Automatically with Power Automate

Camila MilosovichCamila Milosovich Sep 27, 2026 869 views

Question details

The user wants to automatically deduct requested item quantities from a primary stock inventory stored in a different SharePoint list.

How to Subtract SharePoint List Quantities Automatically with Power Automate
Product
SharePoint and Power Automate
Device & OS
not provided
Scenario
Managing inventory across two separate SharePoint lists (one for stock control, one for new requests) and automating the calculation of remaining stock.
Observed behavior
A reliable automated flow needs to be established to dynamically calculate remaining stock, verify inventory limits, and update the primary list when a new request is submitted.
Before you start

Ensure you have the necessary edit permissions for both the Stock Control and Stock Requests SharePoint lists, and verify that you have an active Microsoft Power Automate license.

Solution 1Recommended

Create an Automated Cloud Flow for Inventory Deduction

Build a triggered Power Automate flow that finds the specific item, checks current inventory levels, and updates the remaining stock quantity.

This solution involves triggering a flow whenever a new stock request is created. The flow retrieves the corresponding item from your main inventory list, verifies that there is enough stock to fulfill the request, and performs a subtraction to update the inventory.

You will need to use OData filter queries to accurately match the requested item to your inventory database and leverage the sub() function for the math calculation.

1
Set up the Trigger

Log into Power Automate, create a new Automated Cloud Flow, and select the SharePoint trigger 'When an item is created'. Point the Site Address and List Name to your 'Stock Requests' list.

2
Find the matching stock item

Add a 'Get items' SharePoint action. Connect it to your 'Stock Control' list. In the 'Filter Query' field, write an OData query to match the item, for example: Title eq '[Insert Dynamic Content of Item Name from trigger]'.

3
Verify sufficient stock via Condition

Add a 'Condition' control. Check if the current stock quantity (from the 'Get items' output) is 'greater than or equal to' the requested quantity (from the trigger). This prevents negative inventory balances.

4
Subtract and update the stock list

In the 'If yes' branch, add the 'Update item' SharePoint action pointing to the 'Stock Control' list. For the Quantity field, use the expression editor to subtract the values: sub(item()?['CurrentStock'], triggerOutputs()?['body/RequestedQuantity']). Fill in mandatory fields like the item ID to finalize the update.

Handling missing items: It is highly recommended to wrap your logic in a condition that checks the length of the 'Get items' output (e.g., length(outputs('Get_items')?['body/value']) is greater than 0) to ensure the item actually exists in the stock list before attempting to update it.
Free Microsoft Office alternative

Manage Inventory Easily with WPS Office Spreadsheets

If configuring SharePoint lists and complex Power Automate workflows feels too complicated for your current scale, you can easily track inventory and automate stock deductions using built-in formulas in WPS Spreadsheet. It is a powerful, lightweight, and free alternative to Microsoft Excel.

  1. 1. Download and open WPS Office: Install WPS Office for free and open the Spreadsheet module.
  2. 2. Set up your inventory trackers: Create one sheet for your Master Inventory and another sheet for Logging Requests.
  3. 3. Automate with formulas: Use simple subtraction and SUMIF formulas in your Master Inventory sheet to automatically deduct stock as new requests are added to the log.
Free and lightweight Office suite with lightning-fast performanceFully compatible with Microsoft Excel (.xlsx) formulas and formatsUse built-in spreadsheet formulas (like SUMIF and VLOOKUP) for immediate inventory tracking without cloud flowsFamiliar user interface ensuring a seamless migration with zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

How do I calculate the subtraction exactly in Power Automate?

You can use the sub() expression function. When mapping the new quantity in the 'Update item' action, open the Expression tab and type sub(X, Y), where X is the dynamic content of your current stock and Y is the dynamic content of the requested quantity.

What happens if a user requests more stock than what is available?

If you added a Condition to check that current stock is greater than or equal to the requested quantity, the flow will move to the 'If no' branch. You can add a 'Send an email (V2)' action in that branch to automatically notify the user that their request cannot be fulfilled due to insufficient stock.

Why does Power Automate put my 'Update item' action inside an 'Apply to each' loop?

The 'Get items' action always returns an array of items (even if it only finds one match). When you use dynamic content from 'Get items' in your 'Update item' action, Power Automate automatically wraps it in an 'Apply to each' loop. This is normal and required behavior to process the array.