Inventory & Cash Flow Forecasting
AI for Working Capital Management
The Working Capital Tightrope
Every Indian MSME owner knows this feeling: you have orders in hand, goods ready to ship, but the bank balance is ₹40,000 and salary day is next week. Or the opposite: you overstocked Diwali gift hampers, they did not sell, and now ₹12 lakh of inventory is sitting in the godown gathering dust while you are borrowing at 14% interest.
Working capital management — the art of balancing inventory, receivables, payables, and cash — is where businesses live or die. The numbers are stark: according to RBI data, cash flow problems are the primary reason 60% of Indian MSMEs fail within the first five years. Not lack of demand. Not competition. Cash.
AI cannot give you more cash. But it can help you predict when you will need it, how much inventory to hold, and what your cash position will look like next month — so you make decisions before the crisis, not during it.
Inventory Management Fundamentals
Before we forecast, let us understand what we are managing. Open data/inventory-history.csv — this file contains 12 months of inventory data for a small FMCG distributor with 30 SKUs. Each row shows:
| Column | What It Means | Example |
|---|---|---|
| SKU Code | Unique product identifier | SKU-001 (Tata Salt 1kg) |
| Month | Calendar month | 2026-01 (January 2026) |
| Opening Stock | Units at the start of the month | 450 units |
| Purchases | Units bought during the month | 300 units |
| Sales | Units sold during the month | 380 units |
| Closing Stock | Units at the end of the month | 370 units (Opening + Purchases − Sales) |
| Reorder Level | Minimum stock before you must reorder | 200 units |
| Lead Time | Days between placing order and receiving goods | 7 days |
| Unit Cost | Purchase cost per unit | ₹28 |
| Selling Price | Selling price per unit | ₹35 |
Key Inventory Metrics
| Metric | Formula | What It Tells You |
|---|---|---|
| Days of Inventory | (Closing Stock ÷ Average Daily Sales) | How many days your current stock will last |
| Stockout Risk | Closing Stock < Reorder Level | You may run out before the next shipment arrives |
| Dead Stock | SKUs with zero sales for 3+ months | Money locked in unsellable inventory |
| Carrying Cost | Average Inventory × Unit Cost × Interest Rate ÷ 12 | Monthly cost of holding that inventory (storage + capital cost) |
| Turnover | COGS ÷ Average Inventory Value | How many times inventory is fully cycled per year |
EOQ: The Economic Order Quantity Concept
EOQ (Economic Order Quantity) answers a simple question: how much should you order each time to minimize total costs — the cost of ordering (transport, paperwork, receiving) plus the cost of holding (storage, interest, spoilage)?
The formula is: EOQ = √(2 × Annual Demand × Ordering Cost ÷ Holding Cost per Unit)
You do not need to memorize this. AI can calculate it for you. But understanding the concept is essential: ordering too frequently means high ordering costs; ordering too much at once means high holding costs. EOQ finds the balance.
AI-Powered Inventory Forecasting
The Basic Demand Forecast
Prompt: "Using the inventory data for SKU-001 (Tata Salt 1kg), analyze the monthly sales pattern over 12 months. Calculate: (1) average monthly sales, (2) standard deviation, (3) the month with highest sales and lowest sales, (4) any seasonal pattern. Based on this analysis, recommend how many units to order for next month. Assume lead time is 7 days and we want to maintain a safety stock of 2 weeks of average sales."
This gives you a data-driven reorder recommendation instead of a gut-feeling estimate. The safety stock calculation ensures you do not run out even if demand is slightly higher than expected or the supplier delivers a few days late.
Identifying Problem SKUs
Not all inventory needs the same attention. AI can help you prioritize:
Prompt: "Analyze all 30 SKUs in the inventory data. Classify each into one of four categories: (1) Fast-moving (above-average sales, healthy turnover), (2) Slow-moving (below-average sales, high days-of-inventory), (3) At-risk (closing stock below reorder level), (4) Dead stock (zero or near-zero sales for 3+ months). For each category, list the SKUs and recommend a specific action — reorder, reduce orders, promote/discount, or write off."
This is ABC analysis powered by AI — it tells you where to focus your attention and your capital.
Seasonal Patterns for Indian Businesses
Indian businesses have pronounced seasonality that must factor into any forecast:
| Season/Event | Impact on Different Businesses |
|---|---|
| Diwali (Oct-Nov) | Spike in consumer goods, electronics, clothing, sweets. FMCG distributors should stock up in September. |
| Wedding Season (Nov-Feb) | Spike in textiles, catering supplies, jewelry, event services. Caterers need to forecast staff and raw materials. |
| Monsoon (Jun-Sep) | Decline in construction materials, increase in umbrellas and rainwear. Logistics costs rise. |
| Financial Year End (Mar) | Spike in corporate purchases (use the budget or lose it), bulk stationery, IT equipment. |
| Summer (Apr-Jun) | Spike in cold beverages, AC units, coolers. Decline in winter clothing. |
| GST Quarter End | Businesses accelerate invoicing to claim ITC before the quarterly cutoff. |
Prompt: "The inventory data shows 12 months. Identify which SKUs have seasonal demand patterns — sales that peak in specific months and drop in others. For each seasonal SKU, recommend: (1) when to increase orders (which month), (2) by how much (percentage above average), (3) when to reduce orders to avoid post-season surplus."
Cash Flow Forecasting
Inventory is half the equation. Cash is the other half. Open data/cash-flow-data.csv — this contains 12 months of cash flow data for the same FMCG distributor, broken into three sections:
| Section | What It Includes | Typical Pattern |
|---|---|---|
| Operating Activities | Collections from customers, payments to suppliers, salaries, rent, GST payments | Should be positive most months — this is the core engine |
| Investing Activities | Purchase/sale of equipment, deposits, long-term investments | Usually negative (buying assets) with occasional positive (selling old assets) |
| Financing Activities | Bank loan disbursements, loan repayments, owner's drawings, capital introduced | Positive when borrowing, negative when repaying |
The Cash Flow Cycle for Indian MSMEs
For a typical Indian trading business, cash does not flow in a straight line:
The gap between when you pay your supplier and when your customer pays you is the cash conversion cycle. For many Indian MSMEs, this cycle is 60-120 days — meaning you need working capital to fund 2-4 months of operations before a single rupee comes back.
AI-Powered Cash Flow Prediction
Prompt: "Using the monthly cash flow data, predict the operating cash flow for each of the next 3 months (forecast period). Consider: (1) the average monthly operating cash flow from the last 12 months, (2) any seasonal pattern (identify which months are typically high or low), (3) the current receivables aging (assume 20% of last month's sales are still uncollected). Present the forecast in a table showing projected inflows, projected outflows, and net cash position for each month."
Scenario Planning
The real power of AI-assisted forecasting is scenario planning. Instead of a single number ("we will have ₹5 lakh next month"), you get a range:
Prompt: "Create three cash flow scenarios for Q3 FY27 (October to December) for our FMCG distribution business:
Optimistic scenario: Revenue grows 20% (strong Diwali season), supplier payments stay on schedule, customer collections improve by 10 days.
Base scenario: Revenue stays flat compared to the same quarter last year, no change in payment or collection patterns.
Pessimistic scenario: Revenue drops 15% (weak consumer sentiment), two major customers delay payments by 30 days, one supplier demands advance payment.
For each scenario, show: monthly cash inflow, monthly cash outflow, net cash position at month end, and the maximum working capital gap. Recommend what action to take in the pessimistic scenario — should we arrange an overdraft facility? How much?"
This is the kind of analysis that banks ask for when you apply for working capital finance. Having AI help you prepare it means you walk into the bank meeting with data, not just hope.
Forecast Models Explained
Open data/forecast-models.json — this file contains three forecasting approaches explained in plain English:
Moving Average
Take the average of the last N months and use that as your forecast. Simple, works well when demand is relatively stable. A 3-month moving average smooths out short-term noise; a 6-month average smooths more but responds slower to real changes.
When to use: Stable demand, no strong seasonality. Good for staple goods like salt, cooking oil, basic stationery.
Seasonal Decomposition
Separate the data into three components: trend (is demand going up or down over time?), seasonality (does demand spike in certain months?), and noise (random variation). Then forecast each component separately and add them back together.
When to use: Businesses with clear seasonal patterns. Festival goods, weather-dependent products, wedding season items.
Growth Trend
If your business is growing (or declining), a simple average underestimates (or overestimates) future demand. A growth trend model fits a line through your data and extends it forward, capturing the direction of change.
When to use: New businesses in a growth phase, businesses entering new markets, or businesses in structural decline.
Prompt for model selection: "Look at the sales data for SKU-005 (Festival Gift Box). Which forecasting model would be most appropriate — moving average, seasonal decomposition, or growth trend? Explain your reasoning based on the data pattern you observe. Then apply that model to forecast sales for the next 3 months."
Connecting Inventory to Cash Flow
The real insight comes when you connect inventory decisions to cash impact:
Prompt: "If we increase our order for SKU-001 (Tata Salt 1kg) by 500 units this month at ₹28 per unit, what is the impact on our cash flow? Consider: (1) the immediate cash outflow for the purchase (₹14,000, assuming cash purchase), (2) the carrying cost for holding extra inventory (at 12% annual interest rate), (3) the expected additional revenue if these units sell within 30 days (500 × ₹35 = ₹17,500), and (4) the net cash impact accounting for the time gap between payment and collection."
This is where finance theory meets daily business practice. Every inventory decision is a cash decision. AI makes this connection explicit and quantifiable.
The MSME Cash Flow Dashboard
Build a monthly dashboard prompt that you run at the start of every month:
Prompt: "Generate a monthly working capital dashboard for our FMCG distribution business. Include: (1) Current cash position and forecast for next 30 days, (2) Top 5 SKUs at risk of stockout with recommended order quantities, (3) Top 5 slow-moving SKUs with recommended action (discount/return/write-off), (4) Receivables aging — total outstanding, overdue by 30/60/90+ days, (5) Payables due this month — total amount and due dates, (6) Net working capital gap and financing recommendation. Present in a format suitable for a weekly management meeting."
Run this prompt with updated data every month. Within three months, you will have a trend of your working capital health that shows whether your business is getting tighter or more comfortable — and why.
Key Takeaways
This is chapter 5 of AI for Commerce & Finance.
Get the full hands-on course — free during early access. Build the complete system. Your projects become your portfolio.
View course details