Service level

The Table must be sorted first on Transactions data (oldest to newest) and then on Material (order does not matter).

TableTableTransactions

Table HeaderTransaction quantity + / –

= IF([@[Order type]]=trackOrderType;
[@[Transaction quantity]]*-1;
[@[Transaction quantity]]
)

First the formula compares this row to previous row for Material.

  • If it this row is not the same as previous row, it means (if the Table is sorted correctly) that this is the first time this material occurs. That means fetch the opening stock balance for the year via VLOOKUP, then add or deduct the transaction quantity.
  • If this row is the same as previous row, iterate. That is take the stock balance from previous row, then add or deduct the transaction quantity.

Note: When a formula is long and complex it might be of help to divide the formula into several columns. In this case however, we optimize the calculation speed of formula if we only do VLOOKUP when needed via the IF Function. This is especially important when doing VLOOKUP in even larger amounts of data.

TableTableTransactions

Table HeaderStock balance backorders

= IF([@[Material]]<>OFFSET([@[Material]];-1;0);
VLOOKUP([@Material];TableStockBalance;
MATCH(TableStockBalance[[#Headers];[Stock balance]];TableStockBalance[#Headers];0);
0)+[@[Transaction quantity + / -]];
OFFSET([@[Stock balance backorders]];-1;0)+[@[Transaction quantity + / -]]
)

If we would like to calculate stock value for instance, it is important to remove backorders.

TableTableTransactions

Table HeaderStock balance

= IF([@[Stock balance backorders]]<0;
0;
[@[Stock balance backorders]]
)

TableTableTransactions

Table Header: Supplier name

= VLOOKUP([@Material];TableStockBalance;
MATCH(TableStockBalance[[#Headers];[Supplier name]];TableStockBalance[#Headers];0);
0)

Go to Home > Styles > Calculation.

The quickest way to get all suppliers in a Table is to copy a sheet, remove duplicates and remove redundant data.


TableTableServiceLevel

Table HeaderSales order lines count

= COUNTIFS(
TableTransactions[Supplier name];[@[Supplier name]];
TableTransactions[Order type];trackOrderType
)

Count with criteria Supplier name and Order type SO.


TableTableServiceLevel

Table Header: Backorders count

= COUNTIFS(
TableTransactions[Supplier name];[@[Supplier name]];
TableTransactions[Order type];trackOrderType;
TableTransactions[Stock balance backorders];"<"&0
)

Count with criteria Supplier name, Order type SO and stock balance less than zero (0).


TableTableServiceLevel

Table Header: Order line fill rate

= ([@[Sales order lines count]]-[@[Backorders count]])/[@[Sales order lines count]]

Formula to calculate the KPI Order line fill rate.


Use Conditional Formats with Scales.