cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Josh1
Level II

How do I create a script to calculate expected inventory levels based on a reorder point and order quantity?

Hello,

Attached is a jmp data set with consumption data for a part.  I have a beginners understanding of column formulas, but not enough to achieve the end result I want with this data set.  I'd like to be able to input a starting inventory level, a reorder point, a lead time and an order quantity into a formula or script which will output how many pieces will remain in inventory using those inputs.  In the example below I am starting with 3637 pieces in inventory.  My reorder point is 1510 pieces.  My order quantity (the amount I order when I hit the reorder point) is 600 pieces.  In row 11 my Total inventory level is below 1510 after consuming 572 so I place an order for 600 pieces.  The order takes 2 weeks to arrive so my Total continues to drop until orders start to arrive on row 13 (each row is a week).  I've been trying to use functions like lag to create a similar output in JMP but I'm at a loss.

 

WeekInventory On HandConsumptionTotalPlace order?Order Arrives
136372343403NoN
234032563147NoN
331472722875NoN
428751402735NoN
527352042531NoN
625311782353NoN
723531122241NoN
822411082133NoN
921333801753NoN
1017532401513NoN
111513572941YesN
12941370571YesN
13571586585YesY
14585436749YesY
15749449900YesY
169004321068YesY
1710682521416YesY
1814161821834NoY
1918343272107NoY
2021071761931NoN
2119313671564NoN
2215644981066YesN
2310662251441YesY
2414414961545NoY
2515451203942YesY
269421011531YesY
27531525606YesY
28606933273YesY
29273541332YesY
30332670262YesY
31262146716YesY
327161241192YesY
3311921071685NoY
3416851872098NoY
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I create a script to calculate expected inventory levels based on a reorder point and order quantity?

Here is a script that creates the new data table you want;

Names Default To Here( 1 );
dt = Data Table( "Part A Inventory Data" );

dtRpt = New Table( "Output Report",
	Add Rows( N Rows( dt ) ),
	New Column( "Week", set each value( Row() ) ),
	New Column( "Inventory on Hand" ),
	New Column( "Consumption", set each value( dt:Number of pieces consumed[Row()] ) ),
	New Column( "Total" ),
	New Column( "Place Order", character ),
	New Column( "Order Arrives", character )
);
Current Data Table( dtRpt );

StartingIOH = 3637;
For( i = 1, i <= N Rows( dtRpt ), i++,
	If( i == 1,
		:"Inventory On Hand"n[i] = StartingIOH,
		:"Inventory On Hand"n[i] = :Total[i - 1]
	);
	If( :"Order Arrives"n[i] == "",
		:"Order Arrives"n[i] = "N"
	);
	:Total[i] = :"Inventory On Hand"n[i] - :Consumption[i];
	If( :"Order Arrives"n[i] == "Y",
		:Total[i] += 600
	);
	If( :Total[i] < 1510,
		:"Place Order"n[i] = "Yes";
		:"Order Arrives"n[i + 2] = "Y";
	,
		:"Place Order"n[i] = "No"
	);
);

txnelson_0-1691200494119.png

There appears to be a discrepancy around line 22 in your report table.  You specify to order new parts, however, you report them arrived in one week, not in 2 weeks.  My script sets the arrival week based upon your specification of a 2 week order lag.

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How do I create a script to calculate expected inventory levels based on a reorder point and order quantity?

Here is a script that creates the new data table you want;

Names Default To Here( 1 );
dt = Data Table( "Part A Inventory Data" );

dtRpt = New Table( "Output Report",
	Add Rows( N Rows( dt ) ),
	New Column( "Week", set each value( Row() ) ),
	New Column( "Inventory on Hand" ),
	New Column( "Consumption", set each value( dt:Number of pieces consumed[Row()] ) ),
	New Column( "Total" ),
	New Column( "Place Order", character ),
	New Column( "Order Arrives", character )
);
Current Data Table( dtRpt );

StartingIOH = 3637;
For( i = 1, i <= N Rows( dtRpt ), i++,
	If( i == 1,
		:"Inventory On Hand"n[i] = StartingIOH,
		:"Inventory On Hand"n[i] = :Total[i - 1]
	);
	If( :"Order Arrives"n[i] == "",
		:"Order Arrives"n[i] = "N"
	);
	:Total[i] = :"Inventory On Hand"n[i] - :Consumption[i];
	If( :"Order Arrives"n[i] == "Y",
		:Total[i] += 600
	);
	If( :Total[i] < 1510,
		:"Place Order"n[i] = "Yes";
		:"Order Arrives"n[i + 2] = "Y";
	,
		:"Place Order"n[i] = "No"
	);
);

txnelson_0-1691200494119.png

There appears to be a discrepancy around line 22 in your report table.  You specify to order new parts, however, you report them arrived in one week, not in 2 weeks.  My script sets the arrival week based upon your specification of a 2 week order lag.

Jim
Josh1
Level II

Re: How do I create a script to calculate expected inventory levels based on a reorder point and order quantity?

Thank you sir this is great!