SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL code for Mean Absolute Percentage Error (MAPE)


SQL code for Mean Absolute Percentage Error (MAPE)

Author
Message
nnamdi.oguji
nnamdi.oguji
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 5
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 Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search