SQL code for Mean Absolute Percentage Error (MAPE)

  • Hello,

    I'm have started coding using SQL recently. I have a task to develop Mean Absolute Percentage Error (MAPE) using SQL-T code. This is a forecast error calculation. I'm doing this for a group of items and each item has about 6months demand history.

    I have already done the code to return six months history of data that contains demand(D) and Forecast (F). For one item the demand and forecast history is below. The formular for MAPE is below. I want the sql code to calculate it.

    Demand|6| 7|8|7|3|24|

    Forecast|4| 9|6|3|1|28|

    AbsError(D-F)|2| 2|2|4|2| 4|

    (AbsError/Demand)%|33%|29%|25%|57%|66%|16,7%|

    MAPE =Average((AbsError/Demand)%) =38%

    Pls help 🙂

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply