# Z Score for Safety Stock

Options

Hello,

I need to build a formula to calculate safety stock in Anaplan. I have lead time & usage data available. I am inquiring guidance with developing the z score formula. Inputs will be appreciated, thanks!

Tagged:

• Options

Hey, hey @elif

You can download the Anaplan App that a safety stock methodology that uses the MAPE, I believe the safety stock calculations are in there.

https://community.anaplan.com/t5/supply-chain/Supply-Planning/ba-p/28151

You can also check out the inventory management app too for ideas.

https://community.anaplan.com/t5/supply-chain/Inventory-Management/ba-p/28136

Alternatively, you can simplify your safety stock immensely by just using a forward looking forecast. Meaning, I want to have four weeks of forward supply as safety stock. You can easily accomplish this with a MOVINGSUM function. To be honest, that's what I use, and it works great for most use cases. Once you start going down the optimization path with a MAPE driven safety stock, e.g., I want to be 95% confident that I have enough inventory, then you run into all kinds of problems such as the errors are not normally distributed (which they normally aren't).

• Options

Some general build tips.

-calculate the decimal, round it, and convert it to text

-can use FINDITEM to match the result to a Z-Score "list" which you can manually create pretty quickly one time.  Important thing here is to have the list's code = the rounded number so anaplan can match the z-score to the list

-can do lookups or whatever you need to now for each item!

-the stat forecasting app has ways to calculate mean, median, etc

https://community.anaplan.com/t5/supply-chain/Monthly-Statistical-Forecasting-Calculation-Engine/ba-p/28000

---To calculate the Z-score, subtract the mean from each of the individual data points and divide the result by the standard deviation. Results of zero show the point and the mean equal.

• Options

Thank you @JaredDolich for the recommended apps and the potential solution. Currently, we have a Weeks of Supply on Hand calculation that is driven by forward looking demand (forecast) rather than usage, and the logic for the WOH is similar to the solution you described. I will check the recommended apps to see if I can get further information to build a usage driven formula. Thanks again for the guidance!!

• Options

Thank you for the suggestions @KBeltz! I have checked the stat app to see if there is a standard deviation and z score calculations but there is not any. Is there an excel similar function (STDEV) in Anaplan for standard deviation? Thank you for the support!

• Options

There isn't a STDEV calc in Anaplan.. quite unfortunately.  But there is a twisted way its calced out in the Stat App.

Start tracing back from the module: Descriptive Statistics History Range-->Percentiles

This app has not been updated/built to current best practices but you can get what you need out of it!

• Options

Got it @KBeltz . I somehow downloaded the statistical product forecasting app, which is different. Now, I see the standard deviation calculation. Thanks!