How to complete the data for months current quarter of the last month of the previous quarter

  • Here is the create table and insert the statement how my data is as
    CREATE TABLE SAMPLEDATA (Snapshot_M DATE, Date_Ky DATE, F_Quantities INTEGER)
    INSERT INTO VALUES SAMPLEDATA (SEPTEMBER 1, 2014 ", 1 SEPTEMBER 2014", 14)
    INSERT INTO VALUES SAMPLEDATA (OCTOBER 1, 2014 ", 1 OCTOBER 2014", 13)
    INSERT INTO VALUES SAMPLEDATA (1 NOVEMBER 2014", 1 NOVEMBER 2013', 12)
    INSERT INTO VALUES SAMPLEDATA (DECEMBER 1, 2014", 1 DECEMBER 2013', 11)
    INSERT INTO VALUES SAMPLEDATA (JANUARY 1, 2014 ", 1 JANUARY 2014", 10)
    INSERT INTO VALUES SAMPLEDATA (FEBRUARY 1, 2014 ", 1 FEBRUARY 2014", 90)
    INSERT INTO VALUES SAMPLEDATA (MARCH 1, 2014 ", 1 MARCH 2014", 20)
    INSERT INTO VALUES SAMPLEDATA (APRIL 1, 2014 ", 1 APRIL 2014", 23)
    INSERT INTO VALUES SAMPLEDATA (MAY 1, 2014", 1 MAY 2014', 30)
    INSERT INTO VALUES SAMPLEDATA (JUNE 1, 2014 ", 1 JUNE 2014", 70)
    INSERT INTO VALUES SAMPLEDATA (JULY 1, 2014 ", 1 JULY 2014", 20)
    Desired results set:
    Snapshot_M Date_Ky F_Quantities
    10 1/1/2014-2/1/2014
    10 1/1/2014-3/1/2014
    01/01/2014 41 10/2014
    4/1/2014 5/1/2014 23
    4/1/2014 6/1/2014 23
    4/1/2014 7/1/2014 23

    My requirement is to load the data in the cube.

    So to summarize, data that are loaded onto the month last only a quarter Q1 tax (Jan) should server as a data for the quarter Q2 next month (February, March, April), the data loaded on the last month of Q2 (Apr) will be server as forecast data for Q3 months and so on.

    Thank you in advance.



with

SAMPLEDATA as

(select to_date('09/1/2014','mm/dd/yyyy') snapshot_m, to_date('09/01/2014','mm/dd/yyyy') date_ky, 14 f_quantities of all the double union)

Select to_date (October 1, 2014 "," mm/dd/yyyy ""), to_date (1 October 2014 "," mm/dd/yyyy"), 13 union double all the

Select to_date (November 1, 2013 "," mm/dd/yyyy ""), to_date (1 November 2013 "," mm/dd/yyyy"), 12 union double all the

Select to_date (December 1, 2013 "," mm/dd/yyyy ""), to_date (1 December 2013 "," mm/dd/yyyy"), 11 union double all the

Select to_date (January 1, 2014 "," mm/dd/yyyy ""), to_date (1 January 2014 "," mm/dd/yyyy"), 10 of all the double union

Select to_date (February 1, 2014 "," mm/dd/yyyy ""), to_date (1st February 2014 "," mm/dd/yyyy"), 90 union double all the

Select to_date (March 1, 2014 "," mm/dd/yyyy ""), to_date (1 March 2014 "," mm/dd/yyyy"), 20 union double all the

Select to_date (April 1, 2014 "," mm/dd/yyyy ""), to_date (1 April 2014 "," mm/dd/yyyy"), 23 union double all the

Select to_date (May 1, 2014 "," mm/dd/yyyy ""), to_date (1 may 2014 "," mm/dd/yyyy"), 30 union double all the

Select to_date (June 1, 2014 "," mm/dd/yyyy ""), to_date (1 June 2014 "," mm/dd/yyyy"), 70 union double all the

Select to_date (July 1, 2014 "," mm/dd/yyyy ""), to_date (1 July 2014 "," mm/dd/yyyy"), 20 union double all the

Select to_date (August 1, 2014 "," mm/dd/yyyy ""), to_date (1 August 2014 "," mm/dd/yyyy"), 22 of the double

)

Select snapshot_m, date_ky, last_value (f_quantities) ignore nulls on f_quantities (order by date_ky)

of (trunc (add_months (snapshot_m-1), 'q') select snapshot_m, date_ky,)

-case when trunc (add_months (snapshot_m-1), 'q')! = lag (trunc (add_months(snapshot_m,-1), 'q')) (date_ky order)

then lag (f_quantities) (date_ky order)

end f_quantities

of sampledata

where date_ky > = date ' 2014-01-01'

)

where snapshot_m > = date ' 2014-01-01'

order of date_ky

SNAPSHOT_M DATE_KY F_QUANTITIES
01/01/2014 01/02/2014 10
01/01/2014 01/03/2014 10
01/01/2014 01/04/2014 10
01/04/2014 01/05/2014 23
01/04/2014 01/06/2014 23
01/04/2014 01/07/2014 23
01/07/2014 01/08/2014 20
01/07/2014 01/09/2014 20
01/07/2014 01/10/2014 20

Concerning

Etbin

Tags: Database

Similar Questions

  • How to use mobile data for large app download data

    How to use mobile data for large app download data

    How can I set big data

  • How to install the previous version of sound recorder for windows - the windows sound recorder 7 isn't good

    How to install the previous version of sound recorder for windows - the windows sound recorder 7 isn't good

    Hi Harold,.

    Which is exactly the problem that you are facing with the sound recorder in Windows 7?

    You will not be able to downgrade the version of sound recorder for Windows in Windows 7.

    To learn more about sound recorder in Windows 7, see this link:

    http://Windows.Microsoft.com/en-in/Windows7/record-audio-with-sound-recorder

    To fix the fundamental problems with the tape recorder for Windows 7, see:

    http://Windows.Microsoft.com/en-in/Windows7/open-the-recording-audio-Troubleshooter

    Let us know if it helps.

    Thank you.

  • All my configuration page and fonts have changed suddenly, how to restore the previous settings. THX

    All my configuration page and fonts have changed suddenly, how to restore the previous settings. THX

    Hi André Haub,

    Follow the steps in this document to perform a system restore. This process restores your system to a previous point files.

  • How to import the previous design (presentation of phone) in an existing project?

    How to import the previous design (presentation of phone) in an existing project?

    Of course, two ways actually.

    1: open the two sites against muse and do a select all and copy and paste, or

    2: in the one that you want to import, all select and add to the library, you can easily use this same design on as many sites as you like by adding to your library.

  • How to complete the data or details of the only this year and the previous year for the given RATNG?

    Hi all

    I created a form with 5 blocks (namely ENQACMHDR, ENQACMDTL, ENQACEHDR, ENQACEDTL, ENQACSPEC), where I have 8 push buttons (namely ENTER_QUERY, EXEC_QUERY, CLEAR, FIRST, NEXT, PREVIOUS, LAST, and EXIT).

    This form is created just for display purposes only. So after that I ran, all blocks have been blocked against insert and update.

    I have question on 2 fields 'ENQNO' and "RATNG" (both belong to the ENQACMDTL block).

    When I click on "EXEC_QUERY" directly, all data for all years fills.

    But the user wanted the data to be populated only this year and the previous year.

    Yes, on ' Clause WHERE' of the property_palette of the 'ENQACMDTL' block , I put in the following condition:

    SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYY') OR SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (SYSDATE, 'YYYY')

    PROPERTY PALETTE (ENQACMDTL block)
    WHERE ClauseSUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYY') OR SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (SYSDATE, 'YYYY')


    Data only this year and the year before are now filled. Its ok with the field of "ENQNO".

    The problem is when I have queries on the field "RATNG. 'RATNG' is a Text_item with number of displayed items = 5. (5 lines)


    Here are the 2 columns in a Table (name = ENQACMDTL) in the database.


    ENQNO RATNG
    2013900054500KC2
    2013900047800KC4
    2013520018750KC6
    ...............
    20129000371000KC2
    2012520109500KC2
    2012140019750KC6
    ..................
    2011540036500KC2
    20111000301000KC2
    ..................
    .................
    200610000790KD8
    2006750014750KC6
    2006900072500KC2

    The first 4 issues of "ENQNO" represents the year. There is more than a lakhs of records.

    So, when I have queries on the field "RATNG."

    Example: for RATNG = 500KC2;

    I click on ENTER_QUERY, the field of "RATNG", I put in the 500KC2 of the value and click on EXEC_QUERY; Details regarding the 500KC2 is displayed as well as all the other junk RATNG as 750KC6, 1000KC2 (which belongs to the ENQNO of the current year and previous year) also gets displayed.

    I want details of only RATNG (500KC2) to display, but only for the current year and the previous year, it is 2013900054, 2012520109 (ENQNO).

    Other than 500KC2 RATNG, no other RATNG must be displayed.

    500KC2 = RATNG is also present for ENQNO = 2011540036, 2006900072. But I don't want them to view.

    I want only the data or details of the current year and the previous year to be filled or displayed for the given RATNG.

    Can you help me or tell me what I do for this?

    Hope I'm clear with my question!

    If my question is not clear, let me know please.

    Thank you.

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

    Oracle forms 6i.

    1. check null values in the enqacmdtl.enqno, if so treat them properly.

    2. check the result of select to_char (add_months (sysdate,-12), 'YYYY') prev_year curr_year of double to_char(sysdate,'YYYY')

    3. change the place where clause "year" in the value of numAriques.

    where to_number (substr (enqacmdtl.enqno, 1, 4)) > = to_number (to_char (add_months (sysdate,-12), 'YYYY'))

    Then let me know the result.

  • How to get min date each month for six months?

    Hi, I have data like this.

    Process_date SEQ_No
    ------------- ---------
    16 MARCH 13 733
    9 MARCH 13 732
    MARCH 2, 13 731
    24 FEBRUARY 13 730
    16 FEBRUARY 13 728
    9 FEBRUARY 13 727
    2 FEBRUARY 13 726
    26 JANUARY 13 725
    21 JANUARY 13 724
    JANUARY 12, 13 723
    5 JANUARY 13 722
    29 DECEMBER 12 721
    24 DECEMBER 12 720
    15 DECEMBER 12 719
    DECEMBER 8, 12 718
    3 DECEMBER 12 717
    22 NOVEMBER 12 716
    NOVEMBER 17, 12 715
    10 NOVEMBER 12 714
    NOVEMBER 3, 12 713
    29 OCTOBER 12 712
    23 OCTOBER 12 711
    13 OCTOBER 12 710
    OCTOBER 5, 12 709
    28 SEP-12 708
    22 SEP-12 707
    15 SEP-12 706
    08 SEP-12 705
    01 SEP-12 704



    everymonth admin will refresh the data table and automatically this table above is updated with unique seq_no and process_date.

    I need extarct min date of everymonth (first 6 months discount - excluding the months perceive) and also the seq_no associated to this month so using joins (using the seq_no - which is available in the main table) I can combine the actual data.

    I need result like:

    March 2, 13 731 (I don't need MAR such that it take no data for the current month)

    so I need final result as below:

    2 FEBRUARY 13 726
    5 JANUARY 13 722
    DECEMBER 8, 12 718
    NOVEMBER 3, 12 713
    OCTOBER 5, 12 709
    01 SEP-12 704
    select
     min(Process_date) Process_date
    ,min(SEQ_No) SEQ_No
    -- assuming that se_no increases consecutive with the date, otherwise
    -- min(seq_no) keep(dense_rank first order by process_date) seq_no
    from your_table
    where
    process_date < trunc(sysdate,'MM')
    -- if there is data older than 6 months in your table, which is unclear
    -- from your description and the data
    --and
    --process_date >= add_months(trunc(sysdate,'MM'), -6)
    group by trunc(process_date,'MM')
    order by process_date desc
    

    Published by: chris227 on 25.03.2013 03:00

    Published by: chris227 on 25.03.2013 03:03

  • How to create a date for the restoration of the system when there is no previous restore date.

    When you try to create an earlier date for the restoration of my pc (windows 8.1) for the first time (no previous restore point) the only option I get is to create point of restoration of the date and time of today. I need to restore to an earlier date. Does anyone have a solution?

    You can click on the box "Show more restore points" to view the older, but they may not be as reliable (they may fail to apply or they may not actually work).

    If you do not see the box to check, or the oldest, so it is not of the ancients still show.  If this is the case, you will need to use the 'Refresh PC'.

  • How to complete the data not sorted in the listview?

    Hello

    I use the model dataset to display the list, but the content populated sort alphabatically. How to display the list without sorting?

    Thank you

    Dembélé George Jacob

    Why do you use a sort template when you do not want to sort the list simply use one of the other patterns?

  • How to get the previous month and year accordingly

    Hi friends,
    I wanted to select the month as a number like 4 and the new year 2011
    but I want to choose the previous month from sysdate
    as if the sysdate is June 10, 2011
    It should give me 5 months and
    in the year, it should give as 2011
    If the sysdate is January 1, 2012
    the month should be like 12 and year should be in 2011

    Thank you

    Hello

    776317 wrote:
    Thank you very much I just the 0 being the prefix... can you pls how to avoid that too well pls

    TO_CHAR ( ADD_MONTHS (SYSDATE, -1)
            , 'FMmm yyyy'
           )
    

    For more information on the FM, wee manual SQL language modifier works:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/sql_elements004.htm#sthref456

  • How to generate multiple dates for a year [Sunday or Monday or Tuesday]

    I want to generate number of holidays for 1 year. based on the box I choose I want to generate all the days in the year. example - if I select the Sunday & Monday I want to generate all Sunday, Monday [dates] for a year.

    number of Sundays and Mondays [dates] for a year

    What I would do, is be a table or an index of collection arrayCollection with number of Flex for the day of the week. For example, index 0 will always represent Sunday.
    The State of the check box would change the value of the table at this level, turn MonTableau [0] to true or false

    public static millisecondsPerDay:int const = 1000 * 60 * 60 24;

    private var myArray:Array = new Array;
    myArray [0] = false
    myArray [1] = true
    myArray [2] = true
    myArray [3] = true
    myArray [4] = true
    myArray [5] = true
    myArray [6] = false

    private void GenerateNoofHolidays (): void
    {

    var myDate:Date = new Date();
    var startDate:Date = new Date (myDate.fullYear, myDate.month, myDate.date, 0, 0, 0, 0);
    var endDate:Date = new Date (startDate.getTime () + (365 * millisecondsPerDay));

    While (! startDate > endDate) {}
    for (var x: Number = 0; x)< myarray.length;="">
    If (myArray [StartDate.getDay ()] == false) {}
    He has a holiday doing something, that is to say put a full date of this day in an array / collection arraycollection for manipulation

    }
    startDate.setMilliseconds (startDate.getMilliseconds () + millisecondsPerDay)
    }
    //
    }

    Alert.Show ("\n" + startDate + endDate);
    }

  • How to complete the list of values when loading screen

    Hi all

    I have a list of values based on another field (ANOTHER_FIELD).

    for example
    Select the value d, r
    from table_name
    where id =: ANOTHER_FIELD;

    ANOTHER_FIELD has a default value.

    But when the screen is opened to the list of values does not have the default value and the values list is empty.
    Just when it is filled with submission of the form, the list of values.

    Please tell me how can I complete the list of values when loading screen.

    Thank you!

    Hello

    It depends on how you have defined the default value for ANOTHER_FIELD.

    I always set my default settings using a calculation, that runs before header, on the element that defines the value using a static assignment, but to ensure that the calculation is dependent on the order of the day being NULL - try this

    Andy

  • Update for iOS 15.0.0 is poster Arab annotations in the reverse order / how downgrade to the previous version that worked correctly

    Hello

    Update for iOS 15.0.0 is poster Arab annotations in reverse order

    How to move to the previous version that worked correctly

    the text of shot isn't one Arab readable because it is from left to right (it's in the correct order when writing, but once click reverses)

    Thank youwrong Arabic direction.png

    Hello

    This problem has been fixed in the new version 15.0.3 in the app store.

  • How to complete the form "Adobe Runtimes / reader Distribution License Agreement.

    I just spend some time to talk with Adobe support engineer license that could not solve my problem.

    I intend to distribute Reader and Flash in our windows domain. I don't understand all the technical stuff on the strategies group, installpoints, application of msi MSP etc...

    The issue I'm having is to complete the contract Adobe runtimes distribution /reader license request form.

    https://www.Adobe.com/cfusion/mmForm/index.cfm?name=distribution_form & PV = RDR

    I do not understand what Adobe submit me in the mandatory field labeled "Please indicate the product or service name and description.

    Call me stupid or stubborn, you want to, but I'm reluctant to send this form (and so agree to the license) when I don't fully understand.

    There is no other explanation lies in this form and an engineer support-license-don't know either and this forum was told.

    Who here has already filled out the form and you can help me with my question?

    Also, if someone from Adobe reads this, you can add some tips on the form or short, you support staff on this.

    He wondered about the product or service in which the Adobe software will be 'distributed' - for example if I give a USB to a trade fair for Quahog flanges LLC and include Adobe Reader on it, I type something like "included the flanges of Quahog USB drive, distributed to the general public". In case you might say something like "for distribution within our network of the company only.

  • How to complete the process with the event look inside

    Hi all

    I have a workflow, a part of it contains a branch of the sort Portal:

    Branch 1: Wait point (7 days)

    Branch 2: event listening

    If after 7 days and no event is sent, auto workflow email and closed user

    Otherwise that he will be sent to another user.

    I observe that if the event is received, then at the end of the status of process can be COMPLETED. But if after 7 days and no event is received, after the end user completes the form, the State of the process is still ONGOING.

    I think this approach: 1 sending event adding after waiting in branch 1, it send an event for this branch 2 can be completed.

    Is there another solution to complete such a process?

    Thanks and regards,

    Anh

    instead of using a gateway and a reception event, catch the event on the wait operation (so that the icon of the event is on the corner of the icon of the wait operation). In this way, the event is listened while during the time that the wait operation is running. You draw a route out of operation, and you draw a route out of the capture of the event. In the case of the capture of the event, its route is followed but not the other. Make sense?

    http://help.Adobe.com/en_US/LiveCycle/9.0/workbenchHelp/000113.html#1032048

    Scott

Maybe you are looking for