> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/order-processing/purchase-order/po-configuration/order-quantity-formula.md).

# Order Quantity Formula

**YouTube:** [How to Set Up Formula- Based Order Quantity in Purchase Orders](https://www.youtube.com/watch?v=2orO56B-vbk)?

## How to Set Up Formula- Based Order Quantity in Purchase Orders?

This tutorial explains how to **automatically calculate and add item quantities in a Purchase Order using an Order Quantity Formula** in Logic ERP. This feature helps in making smarter purchasing decisions based on **sales and stock data**.

***

### **Objective of This Feature**

* Automate **purchase quantity calculation**
* Base ordering on **sales performance and stock levels**
* Reduce manual calculations and errors
* Improve **inventory planning and control**

***

### **Define Order Quantity Formula**

* Open **Configuration Window**
* Go to **Other Settings**
* Click on **Order Quantity Formula**

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FKKkQOiGqHT99BZOWvkuT%2FCNF.png?alt=media&amp;token=d983d208-7290-4275-aaba-ce7dbf3a1567" alt=""><figcaption></figcaption></figure>

**Create Formula**

* Use **Field List Option** to view available fields

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FIvHPzsUiSTsdAlYhMAB3%2FfEILD%20lIST.png?alt=media&amp;token=35dc89e1-caf5-4c0c-a611-f0964d9e1fa6" alt=""><figcaption></figcaption></figure>

* Define formula based on:
  * Sales Quantity
  * Closing Stock
  * Other relevant parameters

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FMzCRGjmZxCwJx1Seh9Th%2FFormula.png?alt=media&amp;token=cd52c618-91a7-481d-a851-52fc3b6b678a" alt=""><figcaption></figcaption></figure>

* Click **OK** after defining the formula

***

### **Review Stock & Sales Data**

* Generate **Stock Query Report**

**Analyze Key Data**

* Review:
  * **Sales Quantity**
  * **Closing Stock**

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FYY6C5MRaj2x1Wbof5L7A%2FSTOCK%20REPORT.png?alt=media&amp;token=8eeabc6e-843c-4a27-b8fe-fd7dd2e62c50" alt=""><figcaption></figcaption></figure>

**Purpose**

* Whether ordering is required
* Approximate quantity needed

***

### **Create Purchase Order**

* Open **Purchase Order Window**
* Enter **Supplier Name**

**Go to Item Details**

* Navigate to **Item Details Section**

**Add Items Using Formula**

* Click on **Add Items on Formula**
* Search and choose the item to be ordered

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FUCOyETaT1YV66g0kWtCc%2FPO%20-%20Add%20Item%20on%20Formula.png?alt=media&amp;token=f7ea9e8e-fdb4-41ea-879f-a0cd2bcd7822" alt=""><figcaption></figcaption></figure>

**Define Parameters**

* Enter:
  * **Date Range** (for sales calculation)
  * **Godowns** (for stock consideration)

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FS3dwxgS2Q2crgTW0zCMX%2FDate%20Range.png?alt=media&amp;token=de0ba4a0-c884-4797-b22f-85d8579d8112" alt=""><figcaption></figcaption></figure>

***

### **Automatic Quantity Calculation**

* Based on the defined formula:
  * System calculates **required order quantity**

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FleyfcSoDEoqAvw2QZrhI%2FResult.png?alt=media&amp;token=f75b8d48-76ba-4d04-a1ec-921478a65858" alt=""><figcaption></figcaption></figure>

**Result**

* Displays:
  * **Auto-calculated Order Quantity**

***

### **Key Benefits**

* Eliminates manual quantity calculation
* Ensures **accurate and data-driven ordering**
* Prevents overstocking and stock shortages
* Enhances inventory efficiency

***

### **Best Practice Tips**

* Define formula carefully based on business logic
* Always review stock reports before ordering
* Use appropriate date ranges for accurate results

***

### **Final Outcome**

* Purchase quantities are **automatically calculated**
* Orders are based on **actual sales and stock data**
* Inventory management becomes **smarter and more efficient**
* Decision-making becomes **data-driven and reliable**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/order-processing/purchase-order/po-configuration/order-quantity-formula.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
