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.
AbsError(D-F)|2| 2|2|4|2| 4|
MAPE =Average((AbsError/Demand)%) =38%