Cafe roast-to-brew stock rotation calculator

Calculate first-use allocations and shortages and unserved demand with your own figures.

Your numbers

Use the units shown. Results update as you change valid inputs.

Use first-use allocations and shortages and unserved demand to compare changes to your inputs. The method and limits below explain the scope.

Examples

Examples

Try the starting example

Roast batches [ISO roast date,available kg]; enter JSON
[["2026-10-25",2],["2026-10-28",3]]
Daily demand (kg)
1,2,2
First service date (ISO date)
2026-10-30
Minimum user service age (days)
2
Maximum user service age (days)
7
First-use allocations and shortages (JSON)
{"usage":[["2026-10-30",1,1],["2026-10-31",1,1],["2026-10-31",2,1],["2026-11-01",2,2]],"shortages":[],"expired":0,"remaining":0}
Unserved demand (kg)
0

Try another scenario

Roast batches [ISO roast date,available kg]; enter JSON
[["2026-10-26",3],["2026-10-29",2]]
Daily demand (kg)
2,2,2
First service date (ISO date)
2026-10-31
Minimum user service age (days)
1
Maximum user service age (days)
5
First-use allocations and shortages (JSON)
{"usage":[["2026-10-31",1,2],["2026-11-01",2,2]],"shortages":[["2026-11-02",2]],"expired":1,"remaining":0}
Unserved demand (kg)
2
Calculation method

Calculation method

First-use allocations and shortages (JSON)

For each day discard stock older than max age; satisfy demand from oldest batches aged within [min,max]; input-order ties.

Unserved demand (kg)

Sum daily shortages from stock rotation.

Symbols and units
a
Roast batches [ISO roast date,available kg]; enter JSON
b
Daily demand (kg)
c
First service date (ISO date)
d
Minimum user service age (days)
e
Maximum user service age (days)

Use the units shown. A list keeps the order in which you enter its values. The symbol ^ means “raised to the power of”.

Assumptions & limits

Assumptions & limits

  • Daily oldest-eligible-roast-first stock use within a user-chosen age window, not a freshness or food-safety recommendation. Supported limits: All numeric inputs and computed intermediates must remain finite. Supported numeric input magnitude is zero or 1e-12 through 1e12 in absolute value; reject values outside this bounded range. All lists/JSON record tables are limited to 100 records unless a stricter bound is stated; reject malformed record arity and wrong member types. Valid ISO roast/start dates; quantities>=0; max age>=min age>=0; <=100 demand days.
Are these inputs private?

These calculations run in your browser. A shared link contains the values you choose to share. Only questions submitted to the separate AI finder are sent to OpenAI.

Share this page
Share this calculator

Leave unchecked to share the page without your entered values.