I'm writing some code to do stockitem analysis and provide estimates to purchaser. My source data is actual sold items per valid salesday grouped by week. Let's say week 1-10 have the following sales numbers per valid sales day: 10,11,15,13,7,6,19,8,12,13 (actual numbers are decimal). *) Out of this its easy to calculate average, variance and standard deviation. For now, let's say that stock level today is 100 items. My purchase will arrive in 3 salesdays from today. How many items do I have to purchase to be 98% sure that my stock will last at least 40 salesdays from now?(adsbygoogle = window.adsbygoogle || []).push({});

The solution is going to be written in SQL. I don't need the SQL code, but the algorithm for the calculation would do.

*)

Usually every week has 5 salesdays, but a few weeks every year has less. Due to transportation reasons special days every week peeks on sales. This would cause unneccessary variaton, so therefore i make this "average" per week.

Best regards

Einar Naess

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# How to estimating purchase amount to achieve servicelevel

**Physics Forums | Science Articles, Homework Help, Discussion**