How to display the sales forecasts and Simulated_Forecast?

Hello

I have this table how can I get the values of 2014_Forecast and Simulated_2014 by using the Least_Square_Regresion or REGR_SLOPE function for a period of 3 months.

TRANSACTION_TYPEMONTHYEAR_2012YEAR_20132014_ForecastSimulated_2014
Sales01-18.74-38.00
Sales02-19.60-34.09
Sales03-20.20-33.10
Sales04-19.96-32.21
Sales05-23.13-29.63
Sales06-23.88-28.46
Sales07-30.11-43.89
Sales08-33.69-35.97
Sales09-32.65-29.57
Sales10-37.22-28.18
Sales11-37.15-31.63
Sales12-41.70-32.76

Thanks in advance for your help

Regards¨

Carlos

Why you don't store the DATE as DATE data type data types?

Before you can use REGR_ *, you will need to set your data model.

Quick fix:

alter table sales_unpivoted
  add ( a_date as (trunc( to_date( "YEAR" || "MONTH", 'YYYYMM'), 'MONTH' )));

From there:

  • use a static reference point and the MONTHS_BETWEEN() function to convert the DATE NUMBER (which is REGR_ * what)
  • Use ADD_MONTHS() to convert a DATE

This example uses all values in SALES_UNPIVOTED to solve y = m * x + b

with prediction_results as (
  -- find the solution to the curve y = m*x + b
  select transaction_type
    ,regr_slope( amount, months_between( a_date, to_date('201201','YYYYMM')) ) as M
    ,regr_intercept( amount, months_between( a_date, to_date('201201','YYYYMM')) ) B
  from sales_unpivoted
  group by transaction_type
), x_generator as ( -- we need a "data set" representing the "x" values
  select level - 1 as x
    from dual connect by level < 12 * 4
), prediction_generator as ( -- calculate our "predicted values"
  select P.transaction_type
    ,add_months(to_date('201201','YYYYMM'),X.x) as a_date
    ,P.M * X.x + P.b as predicted_amount -- y = m*x + b
  from prediction_results P, x_generator X
)
-- join everything together
select U.transaction_type, G.a_date, U.amount, G.predicted_amount
  ,months_between( G.a_date, to_date('201201','YYYYMM'))
    as x_axis
from sales_unpivoted U
right outer join prediction_generator G
  on (U.a_date = G.a_date and U.transaction_type=G.transaction_type)
order by G.a_date;

Three month avg, etc. is just a classic analysis with windowing clause.

MK

Tags: Database

Similar Questions

  • How to display the language bar and bring back the language switch to the taskbar?

    How to display the language bar and bring back the language switch to the taskbar?

    How to display the language bar and bring back the language switch to the taskbar?

    Hello

    According to the description, I understand that you do not want to display the language bar.

    I would like to know some information.

    1. You hide the language bar, or missing?

    I suggest you try the steps mentioned below and check.

    1. Go to the control panel.

    2. Click on clock, language and region.

    3. Region and language.

    4. Keyboard and language tab.

    5. Change keyboards button.

    6. Language bar tab.

    Then simply change the parameters of language bar hidden in the "embedded in the taskbar" and check.

    Here, you can also check the option in the check box for display icons of language in addition to the taskbar bar.

     

    Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.

  • How to display the hidden files and folders even if I've already enabled "Show hidden files, folders and drives" to "Advanced settings"?

    How to display the hidden files and folders even if I've already enabled "Show hidden files, folders and drives" to "Advanced settings"?

    After I enabled "Show hidden files, folders and drives" in 'Advanced settings', I can't yet see in the folder but I know there is a file in this program of WinRAR folder form as pictured below where I opened the case both at the same time.

    Hope you can help in this case...

    It would be possible that the file is marked as a system folder (which is just a check box in properties such as the hidden check box). So in your folder options, uncheck the "Hide protected operating system files" and see if it will be visible.

    Or another thing to try: remonter back a level, hold down SHIFT while you right-click the complete file and choose "Open command window here", then type DIR to see if the file is listed.

  • How to display the user id and the session on the form?

    Hi all can someone guide me how to display the user id and the session on the form? Please guide me

    Sarah

    Hi Sarah,.

    You can use GET_APPLICATION_PROPERTY (CONNECT_STRING) for this.

    BTW, have you tried search in forms online help? It has good examples explaining all the built-ins.

    Arun-

  • How to display the member name and/or Alias according to generation in Studio EN?

    I have a report that contains relatives in lines that are set to stretch and show Member aliases. During the expansion under the parent I would like to display the member name and Member Alias. I tried conditional formatting to replace the Alias members using a text function, but replace only accepts text, not functions. Does anyone know how to do this?

    I use 11.1.2.3

    Do you need to in the same column? If this isn't the case, you could pull in another column of the alias and use conditional formatting to hide either or depending on the generation.

  • How to display the clock (time and date) in the task bar at the bottom of the right hand of the computer

    I ask for help.

    I want to be able to display the clock (time and date) in the taskbar at the bottom right of the computer

    Hi FrankNikolich,

    Thanks for asking! I understand that you want to display the clock and date in the system tray.

    1. have there been recent changes to the system before the show?

    Follow these steps and check if that helps.

    (a) right click on the taskbar, click Properties, click Notifications.

    (b) click on the Customize tab, click on the System Turn On or OFF icons.

    (c) in the drop-down list, select Yes for the clock.

    (d) click OK.

    Answer us with the results. I'd be happy to help you further.

  • How to display the menu bar and address at the same level?

    Firefox 4 seems good, but a major problem is that the menu bar, the bar tabs and the Navigation has a bar a clean upper-left line in the window, with mainly two effects:

    1. Much space wasted on the top right
    2. The real web window being compressed very vertically, so if you have a laptop or widescreen for another reason, then it isn't really a lot of space on the left for navigation.

    The Compact Classic add-on does not solve this problem, but with the adverse bars becoming quite small and rather hard-to-reach buttons. A better solution would be to show the menu bar and the Navigation bar at the same level, but how?

    Default on Win7, Firefox 4.0 not same poster not the Menu bar - the orange Firefox button is displayed. Right-click on the Menu bar and click on the menu bar in this context menu to deselect. When you have the orange Firefox button projection and the menu bar is hidden, you can access the Menu bar by pressing the ALT key .

    Or, you can open the toolbar Customize mode and move items from Navigation bar in the Menu bar, and then hide the Navigation bar.

    https://support.Mozilla.com/en-us/KB/how+to+customize+the+toolbar

    http://KB.mozillazine.org/Toolbar_customization

    In addition, there are a number of compact menu extensions that deal with compaction of the Menu bar down to a button that replaces the menu bar and provides a drop-down list of these menu items. Or extensions that allow you to Customize the Firefox button menu and add menu items that aren't there, but who are in the menu bar. Using most of these types of extensions involves using customize to move the items according to your tastes.

  • How to display the URL bar and the bookmarks bar when I open addons page?

    It seems counterintuitive to me that the Firefox addons page doesn't have the same toolbars than the other tabs, and I've not found an option to add them back in (or an add-on to fix). Instead of being able to enter a URL directly from the addons page or click a bookmark, I leave the tab before I can go anywhere else. In addition, it looks like graphically its place when I go through tabs, and most toolbars disappear for a second that I move on the addons tab.

    Other utilities that use their own pages manage to preserve customization of the toolbar without remove it completely, so I wonder if there is a way for the addons page to do as well.

    The addon Download Manager Tweak is an example of another utility that has its own page without removing the toolbars. One of its options allows the user to open their download as a tab page, which also contains the normal customization of the toolbar, the browser tabs.

    Thanks in advance!

    If you enter one of the following in the Firefox location bar (address bar) shows as the Manager of modules they way you want it to appear?

    chrome://mozapps/content/extensions/extensions. XUL

    See also: http://superuser.com/questions/264113/show-toolbars-the-add-ons-manager-tab-is-open

  • How to display the address area and the back backward arrows

    My address box and back arrows are not visible

    User Agent

    Mozilla/5.0 (Windows; U; Windows NT 5.1; Chrome/4.1.249.1064 en-US) AppleWebKit/532,5 (KHTML, like Gecko) Safari/532,5

    Is it missing one or several toolbars, such as the bookmarks (links to Web sites containing) or navigation (containing the button bar and address rear) see the Navigation buttons such as back, home, bookmarks and recharge are missing.

    If missing the top browser menu bar, see what happened to the file, edit and view menus?

  • How to display the splash screen and background

    Hello

    I have an application that gets images from a server and displays them. what I want to do is to display a loading screen while the images are download and go to another screen when the download is complete. is this possible?

    Thank you

    Dieye

    Yes, it is possible.  You can use a PopupScreen to do this.  Please take a look at the JavaDocs for dialogue, status and PopupScreen for examples of classes, that you can use to display a "please wait" type of screen.

    Once you download is finished, you can close the screen and push the other onto the stack.

    Please note the following if you try to manipulate your download lead active USER interface.

    How - to upgrade a screen on the main event Thread
    Article number: DB-00136

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

  • How to display the file size and the number of files in the folder

    I have a laptop and a desktop at home. When I open a folder on my laptop, my laptop display size (on the bottom right corner) and the number of objects (at the corner of bootom left hand) of this file the bottom of the window.  But I don't see this information on my desk. I tried to play with the Option - view folders... but always in vain.  Can I know what is the correct way of doing things?

    Hello cscs77, welcome.

    The option that you are referring to I think would be the bar of "Status". This gives a test:

    1. open 'My Documents '.
    2. at the top, click on view > status bar

    That should solve your problem. Let us know,

    Thank you! Ryan Thieman
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to display the French characters and have the function of nav

    I have a website that I had to add pages in French. When I downloaded it, the server has not found pages (URL contains accented characters). I found conflicting info on the person to handle this.

    1. I've tried in the URL convert the character into its HTML equivalent. The advantage: the server has acknowledged and navigation passes correctly, however the URL seems clumsy as it shows the HTML character in the URL.

    2. I tried to change the metadata of the character set UTF-8 than indicated in french. That makes the work of nav, but accented everything on the page looked funky characters.

    3. Google suggests to keep the set of characters in UTF-8 format but adding the equivalent ASKII for the character highlighted in the URL. Done that and the nav does not recognize them. (When I changed the URL of the page, it also updated the href page to display ASKII characters in the name. I tried both ways with the href attribute in page nav using ASKII characters and accented characters).

    Anyone has experience with that or recommendations to do it correctly?

    Accents in URLS are not allowed and cannot be encoded. See this article on Wikipedia.

    Use only the characters a - z, digits 0-9, hyphen, underscore, dot and squiggle.

    http://transworldsigns.com/FR/Industrie_financi ere.html

    Returns a 404, while http://transworldsigns.com/fr/Industrie_financiere.html

    will work.

  • How to display the current page and the total number of pages for a group

    Hi all
    I have a requirement to indicate the current page number and the total number of pages for a group. For example:

    < A >
    < 1 >
    Row1
    row2
    ....
    Clotilde
    < / 1 >
    < 2 >
    Row1
    row2
    ....
    Clotilde
    < / 2 >
    < 3 >
    Row1
    row2
    ....
    Clotilde
    < / 3 >
    < /A >

    Now my requirement is Group 1 can have lines going into several pages say x, so I need to show with in the Group 1 x and on the next page page 1 page 2 x etc.
    Although Group 2 spans several pages, I need to see page 1 of y... etc.

    Can someone help me please how to do this?


    Thank you
    Sunny

    Try if@section

  • How to display the appdata directory and all of its subfolders? __

    I used winzip to decompress a file to the defauld /users//appdata/local/temp dir but can not find the file or directory

    In Windows Explorer: Options\View Organise\Folder and research and select Show hidden files, folders and drives.

  • How to display the list of components in ultiboard 10?

    The DRC report the errors where the components that are no longer in the design have been removed. How to display the list component and then remove them from the netlist to stop this?

    Ultiboard reported missing errors of component (part 'X' is not about design) because the part is always referenced by a net. To fix this, you must remove the part of the net. Following the steps below to remove the part form the net.

    1 tools > Netlist Editor

    2. for each network that the part has been connected to, select the Net (upper-left).

    3. Select the tab of pine trees, select the part and it is the PIN in the dialog box, then click on remove

    The problem is when the part is removed, I see no easy way to determine the threads you need to remove the part of. I entered this as a feature request to make this easier, but as a workaround, you can put part and say Ultiboard what the missing part, then search the net names on the pins and remove the part of these pins

    1 place a piece with a lot of pine trees (for example the part that was removed, or for example through Hole technology > Connectors > SIL & headers > HEADER2X9). When you place the part, make sure that the RefDes matches the RefDes of the part which has been removed.

    2. once the room is placed, you should see rats nest lines that connect the part to the nets.

    3 Zoom on the pins. You should now see the net name on each of the axes. For each of the pins connected, remove it from the net as described above.

    4. remove the part that you placed.

Maybe you are looking for