A moving weighted average algorithm under abnormal conditions

Source: Internet
Author: User

A moving weighted average algorithm under abnormal conditions

What is the moving weighted average method?

Baidu's explanation: The Moving weighted average method refers to the cost of each purchase plus the cost of the original inventory, divided by the quantity of each purchase and the original inventory of the quantity of the sum of stock,

Calculates the weighted average unit cost as a method of calculating the cost of the current month's inventory and the cost of ending inventory.

This can only be said to be the normal use of (or in the case of written ideal) moving weighted average algorithm.

This algorithm is built on the advanced goods (with the inventory cost), after the sale of the conditions can be calculated.

What do you mean, abnormal conditions?

Because there is the phenomenon of "first selling backward" exists. If the goods are not in stock, they will be sold. At this time, the product information is not perfect (only the price of goods, no price, no inventory quantity), the goods will be sold.

Each sale of a product reduces an inventory quantity, because there is no stock, so the inventory quantity of goods will appear "negative inventory".

Sales cost price is not known.

How to calculate the moving weighted average price of a commodity under unusual circumstances (hereinafter referred to as the average price)?

There are 3 kinds of situations:

1) When the original average price of a commodity = 0, the average price of the commodity = The cost price of the purchase

2) when the original average price of a commodity is null (the product has not been initialized, so the average price is null), the average price of the commodity = The cost price of the purchase

3) When the original average price of the goods >0, (original average price * Stock quantity + this purchase cost)/(stock quantity + this purchase quantity)

Stock Quantity = Original stock quantity + current purchase quantity

Inventory Cost = Average price * Inventory quantity

A moving weighted average algorithm under abnormal conditions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.