Calculating availability

The reports for the availableSupplyChange.v2, productAvailability.v2 and dgAvailabilityChange.v2 events have total availability, which includes safety stock that is withheld.

Suppose today is January 1 and the supplies in the system are as follows:
  • Supply1 = lowDate till February 1 - 10 qty
  • Supply2 = lowDate till March 1 - 12 qty
    Note: lowDate refers to any old date in the past. Here, lowDate is considered as 1900-01-01.
The Demand = 3 qty and Safety for SHP = 21 qty.
The events of availableSupplyChange.v2, productAvailability.v2, and dgAvailabilityChange.v2 look as follows:
availableSupplyChange.v2
  • fromTs of the first availability window is the lowDate which is 1900, toTs is February 1, and supplyQuantity is the Supply1 which is 10 qty.
  • The demand of 3 qty is matched with the Supply2 of 12 qty that makes the demand quantity as 3 in the second block.
  • For the safety = 21 qty, consumedSafetyQuantity becomes 10 qty for the first availability block and remaining is 21 - 10 = 11 qty for safety.
  • The 11 qty of safety gets adjusted with the next supply on Supply2.
  • fromTs of the second availability window is the lowDate which is 1900, toTs is March 1, and supplyQuantity is the Supply2 which is 12 qty.
  • With the active supply of 12 qty and the demand = 3 qty adjusted, the consumedSafetyQuantity becomes 9 qty.
  • The remaining 2 qty of safety goes in safetyShortage.
The sample json looks as follows:
{
  "availableQuantity" : 0.0,
  "consumedSafetyQuantity" : 10.0,
  "demandQuantity" : 0.0,
  "demandShortage" : 0.0,
  "fromTs" : "1900-01-01T00:00:00.000Z", 
  "fulfillmentAllowed" : true,
  "reservationShortage" : 0.0,
  "reservedQuantity" : 0.0,
  "safetyShortage" : 0.0,
  "shortageQuantity" : 0.0,
  "supplyQuantity" : 10.0,
  "toTs" : "2024-02-01T00:00:00.000Z"
}, {
  "availableQuantity" : 0.0,
  "consumedSafetyQuantity" : 9.0,
  "demandQuantity" : 3.0,
  "demandShortage" : 0.0,
  "fromTs" : "1900-01-01T00:00:00.000Z",
  "fulfillmentAllowed" : true,
  "reservationShortage" : 0.0,
  "reservedQuantity" : 0.0,
  "safetyShortage" : 2.0,
  "shortageQuantity" : 2.0,
  "supplyQuantity" : 12.0,
  "toTs" : "2024-03-01T00:00:00.000Z"
}
To calculate the availability without considering safety in any of the events, you can manually compute the availability for each block with the following formula.
Availability without considering safety = availableQuantity + consumedSafetyQuantity

For more information on definitions, see definitions.

Note: shortageQuantity = demandShortage + reservationShortage + safetyShortage.
productAvailability.v2
In the productAvailability.v2 event, availability is represented using time ranges and not absolute dates.
During both Supply1 and Supply2, the supplies are active during the period that is represented by currentAvailability block.
  • The supplyQuantity for currentAvailability is the sum of supplies for Supply1 and Supply2.
  • The consumedSafetyQuantity is defined as safety that we can withheld with the available supply.
  • The futureAvailability block considers only the Supply2.
The sample json file looks as follows:
"currentAvailability" : {
   "availableQuantity" : 0.0,
   "consumedSafetyQuantity" : 19.0,
   "demandQuantity" : 3.0,
   "demandShortage" : 0.0,
   "fulfillmentAllowed" : true,
   "reservationShortage" : 0.0,
   "reservedQuantity" : 0.0,
   "safetyShortage" : 2.0,
   "shortageQuantity" : 2.0,
   "supplyQuantity" : 22.0,
   "thresholdLevel" : 3,
   "toTs" : "2024-02-01T00:00:00.000Z"
},
"futureAvailability" : [ {
   "availableQuantity" : 0.0,
   "consumedSafetyQuantity" : 9.0,
   "demandQuantity" : 3.0,
   "demandShortage" : 0.0,
   "fromTs" : "2020-02-01T00:00:00.000Z",
   "fulfillmentAllowed" : true,
   "reservationShortage" : 0.0,
   "reservedQuantity" : 0.0,
   "safetyShortage" : 2.0,
   "shortageQuantity" : 2.0,
   "supplyQuantity" : 12.0,
   "toTs" : "2024-03-01T00:00:00.000Z"
} ]
To calculate the availability without considering safety in any of the events, you can manually compute the availability for each block with the following formula.
Availability without considering safety = availableQuantity + consumedSafetyQuantity
When the tenant level rule event.alwaysPublishEventForDelMethod is enabled with delivery method and event is published despite fulfillment being disabled, then use the following formula to calculate the availability:
MAX(supplyQuantity - demandQuantity - reservedQuantity-reservationShortage, 0)
For more information on definitions, see definitions.
Note: shortageQuantity = demandShortage + reservationShortage + safetyShortage.
dgAvailabilityChange.v2
The example is similar to productAvailability.v2. For more information, see productAvailability.v2.