理论 - 从订单历史计算未来 12 天的订单

Theory - calculating orders for next 12days from order history

我正在使用以下查询来获取 "forecast":

(select ROUND(sum(abs(l.piece))/count(distinct trunc(l.date_p)))*12
from vu_turnover l, orders_l cl where
regexp_replace(l.rid_v, '!.*', '') = cl.rid 
and cl.user = 46 -- not_stock_price
and TO_CHAR(l.date_p,'W') = TO_CHAR(SYSDATE,'W') -- current_week
and l.date_p >= add_months(trunc(sysdate, 'YEAR'), -12) -- last_year
and l.code_id = item.id 
and Substr(cl.flags_s, 12, 1 ) = 2 -- executed_order
and l.code_o IS NOT NULL and l.partner in (X,Y))

工作正常,returns - average of all piece which was sold through the current week(1-4) in the month at last + current year 的值。它乘以 12.

Table vu_turnover 看起来像这样(它与 orders_l 相连):

orders_id    code_o    date_p    partner    piece    code_id    l.rid_v
00000123      01     01.01.2018    XY         5        2789    000014!03
00000124      01     01.01.2018    XY         5        2789    000014!03
00000125      01     12.02.2018    XY        10        2789    000015!08
00000128      01     24.03.2018    XY         5        2789    000034!05
00000129      01     05.05.2018    XY        10        2789    000119!09

在 table 中是 ID-s 的每日销售额

有没有更好的IDEA来做未来12天的预测?

在 Oracle 中有两种可能性 - 您可以使用:

  • 线性回归,
  • MODEL 条款。

除非你有平稳的时间序列,否则平均方法不是很好。