Stock and other balances
Adding daily or monthly stock levels gives nonsense. A balance is read at the end of the period.
Sample data
Made-up data. If you have not loaded it yet, ask your assistant:
Load https://gotsimplified.com/samples/shop_stock.csv into my data lake as samples.shop_stock, replacing it if it already exists.
Download: shop_stock.csv
Try this
Save an analytics model named shop_stock from samples.shop_stock. The date column is date. Measure on_hand is the sum of on_hand, and it is a balance.
Compare month end stock in shop_stock with the month before, by product.
Your assistant may word its answers differently each time; the numbers come from your tables.
What you should see
With the sample data. Use these to check the answer.
- Total stock is 1,735 against 1,760, down 1.4%.
How to read the answer
Each number is the level on the last date of the month.
Good to know
Say the measure is a balance when saving, or months will be added together.