Next quarter to the selected quarter

Hi Experts,
Our requirement is to show the data in the report for the next rolling up quarters to the selected quarter in the prompt.
Ex. If user has selected 2010-Q2 then report should show the data for 2010-Q3, 2010-Q4,2011-Q1 and 2011-Q2.
Please suggest, how to implement as we are just aware of AGO function in OBIEE.
Thanks
Meera

You see, if course, that your first issue is that 2010-Q2 is a CHAR field and to apply time functions, you need to work with actual dates. So you will need to map the dates to the appropriate quarter and year. Once you have that, here is how to build it:
1) TIMESTAMPADD(SQL_TSI_QUARTER,-1,TIMESTAMPADD(SQL_TSI_DAY,-(DAY_OF_QUARTER(yourdatecolumn))+1,yourdatecolumn))
As I mentioned in the other thread that Kart quoted, the formula above will give you the first day of the quarter in which the date column exists. The date column is the one your user will pick. Now, to get the 4th quarter after this, use this SQL:
2) TIMESTAMPADD(SQL_TSI_QUARTER, 4,TIMESTAMPADD(SQL_TSI_QUARTER,-1,TIMESTAMPADD(SQL_TSI_DAY,-(DAY_OF_QUARTER(yourdatecolumn))+1,yourdatecolumn)))
The above SQL will give you the 4th quarter after the one in 1)
Now you have your two endpoints. Build your filter on the time column in your report and it should be between 1) and 2).

Similar Messages

  • Last date of the selected quarter

    hi all - I have been struggling to figure out how to get the last date of selected quarter. for example, if the user has selected 2014 Q1 from the date hierarchy, I want to show 2014-03-31.
    any idea how to accomplish this? thanks in advance

    Hi Sam,
    There are several ways to do this in MDX.  
    One way is to use LastChild a few times.  For example, if your hierarchy had Period, Week, and Day below Quarter, and you were sure the user had selected a Quarter (the MDX could check) try this assuming your date hierarchy is calle [Date].[Fiscal
    Calendar].    [Date].[Fiscal Calendar].lastchild.lastchild.lastchild
      The first lastchild will get the last Period in the Quarter, the second lastchild the last week in that Period and the third lastchild will get the last day of that week.
    Another way, which will work for any level they selected would be something like; assuming the Day level is called [TheDate].   Tail(Descendants([Date].[Fiscal Calendar],[Date].[Fiscal Calendar].[TheDate]),1).item(0)  The descendants
    gets all the days in the selected period, the tail gets a set including just the last day, and Item(0) gets that particular day.
    Of course, the MDX snippets above could be used in larger MDX expressions.
    Hope that helps.  It really is worthwhile to learn a little MDX.  Remember, anything is possible in MDX if the cube has the data.
    Richard

  • Help on the selection screen.....Select-options default values

    Dear Friends,
    We have one requirement,i.e. In Report program i am using select-option once will execute the program ALV report will be generated.In ALV Report we have one button like 'WM DATA'.Once click the WMDATA one pop-up is displaying...In that pop-up also same select-options are there upto here it's working fine...Now my problem is on pop-up select-options i have to display by default..... which i am using on report select-options values.
    Please help on the same
    Thank You.

    Do like this. Before calling your next screen assign the select option value or just assign the value in start of selection only.
    tables
    :lqua.
    SELECT-OPTIONS:
    s_lgnum FOR lqua-lgnum MODIF ID sc1 OBLIGATORY,
    s_lgtyp FOR lqua-lgtyp MODIF ID sc1.
    SELECTION-SCREEN BEGIN OF SCREEN 300 .
    SELECT-OPTIONS : s_lgnum1 FOR lqua-lgnum OBLIGATORY,
    s_lgtyp1 FOR lqua-lgtyp OBLIGATORY.
    SELECTION-SCREEN END OF SCREEN 300.
    START-OF-SELECTION.
    s_lgnum1[] = s_lgnum[].
    s_lgtyp1[] = s_lgtyp[].
    call SELECTION-SCREEN 300.

  • Select statement for last day of the last quarter and first quarter

    Anybody provide me the single select statement which should result the last day of the last quarter and last day of current quarter?
    Ex: Select last date of the last quarter,last day of current quarter from XYZ(DUAL...)
    Thanks in Advance

    Hi,
    Here's one way:
    SELECT               TRUNC (SYSDATE, 'Q') - 1     AS prev_qtr_end
    ,     ADD_MONTHS ( TRUNC (SYSDATE, 'Q') - 1
                 , 3       
                 )                    AS this_qtr_end
    FROM    dual;TRUNC (dt, 'Q') returns the first day of the quarter containing dt.
    Subtract one day from that, and you have the last day of the previous quarter.
    Add 3 months to that, and you have the last day of the current quarter. ADD_MONTHS (dt, n) will always return the last day of a month if its first argument, dt, is the last day of a month.

  • Help needed in getting the previous Quarter Data

    Hello folks,
    I have this procedure where i have to modify the current procedure in the following manner:
    I need to get rid of the variables p_start and p_end so that i cannot see them in the crystal report and include the Frequency in the procedure to get the Data based on the Dates.
    and Main requirement is" If the Frequency is Quarterly " it should get the previous quarter Data, if "Frequency is monthly" it should return the previous month data.Can anyone please let me know where shud i make changes. Am including the procedure for refernce. Any help is appreciated
    Thanks a millioin,
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h(report_record in out cr_return_types.gen_cursor,
    p_start       string,
    p_end         string)
    IS
    v_startdate date;
    v_enddate date;
    BEGIN
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));
    open report_record for
    select --distinct r.recovery_id
    r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    sum(nvl(r.amount, 0)) as amt_received,
    nvl(sum(case
    when r.amount >= 0 then
    rd.fees
    else
    rd.fees * (-1)
    end),
    0) as fees,
    ec.close_date, *001* commented
    (case
    when ec.close_date <= to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS') then
    ec.close_date
    else
    null
    end) as close_date, --*001*  added
    get_case_value(ec.event_id, ec.event_case_id, v_enddate) as case_value,
    nvl(etl.fee_percent_flag, 'N') workmans_comp,
    max(to_char(r.recovery_date, 'FMMonthYYYY')) Year_Month,
    max(to_char(r.recovery_date, 'YYYYMM')) Y_M,
    max(to_date(to_char(r.recovery_date, 'MMYYYY'), 'MM/YYYY')) date_MY
    from recovery r,
    recovery_detail rd,
    event e,
    client c,
    branch_group b,
    employer_group g,
    event_case ec,
    event_type_lookup etl
    where r.event_id = e.event_id
    and r.event_case_id = ec.event_case_id
    and ec.event_id = e.event_id
    and rd.recovery_id(+) = r.recovery_id
    and r.recovery_date between v_startdate and
    to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS')
    and e.client_id = c.client_id
    and g.client_id = c.client_id
    and b.client_id = c.client_id
    and g.employer_group_id(+) = e.employer_group_id
    and b.branch_group_id(+) = g.branch_group_id
    and e.event_type_code = etl.event_type_code -- SST 130852 04/14/09
    group by r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    ec.close_date,
    get_case_value(ec.event_id, ec.event_case_id, v_enddate),
    nvl(etl.fee_percent_flag, 'N')
    having sum(nvl(r.amount, 0)) <> 0
    order by c.client_code,
    b.branch_group_code,
    g.employer_group_code,
    r.event_case_id;
    Edited by: user11961230 on Oct 20, 2009 9:02 AM

    user11961230 wrote:
    1. I want to get rid of the p_start and p_end. So how do i declare the v_startdate and v_enddate in the following part?
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));I'm not sure what you mean by "declare".
    In PL/SQL, "declare" means state (at the beginning of a block) that there will be a certain variable with a certain name (such as v_startdate) and datatype (such as DATE). You're already declaring the variables v_startdate and v_enddate correctly, right before the BEGIN statement.
    Declaring a variable is not the same as initializing it, that is, giving it a value for the first time. Your next question seems to be about initializing..
    2. where exactly shud i include the logic that u have mentioned. sorry a dumb questionIn place of the two assignment statments that reference p_start and p_end.
    3. This time am gonna use frequency instead of report_type so that i will get rid of the p_start and p_end from the procedure.Do you mean you want to pass an argument (called frequency) that tells if you want a quarterly or a mionthly report, just like the variable report_type in my example?
    If so, replace report_type in my example with frequency.
    I think you want something like this:
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h
    (      report_record         in out     cr_return_types.gen_cursor
    ,      frequency         IN           VARCHAR2
    IS
         -- Declare local variables:
         v_startdate     date;
         v_enddate      date;
    BEGIN
         -- Initialize v_startdate and v_enddate, depending on frequency
         IF  frequency = 'QUARTERLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -3)
                                           , 'Q'
              v_enddate := TRUNC (SYSDATE, 'Q');
         ELSIF  frequency = 'MONTHLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -1)
                             , 'MM'
              v_enddate := TRUNC (SYSDATE, 'MM');
         END IF;
         --   Subtract one second from v_enddate
              v_enddate := v_enddate - ( 1
                                            / (24 * 60 * 60)
         open report_record for
         select --distinct r.recovery_id
                r.event_id,
         and     r.recovery_date  BETWEEN  v_startdate     
                         AND       v_enddate
         ...When you post formatted text on this site (and code should always be formatted), type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Edited by: Frank Kulash on Oct 20, 2009 2:37 PM
    Changed query to use BETWEEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Scanning problem with HP Deskjet 3050A - only scans about a quarter of the page

    My HP Deskjet 3050A wirelessly prints just fine with my Mac Lion OS 10.7.3. But whenever I scan something, the resulting scan captures only about a quarter of the page, which is blown up in size to take up the entire page. (And I'm scanning regular 8"x11" documents.) And I can't zoom in to get the whole page. When I try to change the setting in Utility from jpg to pdf, to see if that will solve the problem, the Utility quits "unexpectedly" every time.
    This question was solved.
    View Solution.

    Hi,
    First, install the Critical Update below:
    http://ftp.hp.com/pub/softlib/software12/COL41827/mp-101648-1/HP_Scan_for_Mac_OS_X_10.7_Update.dmg
    Now change the device settings as following:
    1. Open the HP Utility and select your device.
    2. From Scan Settings open the "Scan to Computer".
    3. Click the "Scan Tasks" tab.
    4. Select the Scan Shortcut used to scan, then click Edit.
    5. In the section of Scan from an HP Device click on the blue triangle to enlarge the menu.
    6. From the enlarged menu now open the drop-down menu next to Crop To and set as None.
    7. Click OK and try scanning.
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Flash videos only play in a quarter of the screen

    This problem has been going on with my MacBook Pro for months... on some sites, Flash videos in fullscreen mode only take up a quarter of the screen, with the rest black. This happens on every browser, and persists regardless of the number of times I've cleared the browser cache, history, etc. Anyone have a fix?

    Usually at the bottom toolbar of the video window, there is a Full Screen button. Is it missing?
    1. System Preferences >  Flash Player > Advanced >  Delete  All
         Press the "Delete All" button.
         Install Adobe Flash Player.
        http://get.adobe.com/flashplayer/
       Download it first.
       The next step is important.
       Click Safari in the menubar and select “Quit Safari”.
        Follow the prompts and install it.
        Restart computer. Relaunch Safari.
    2. Safari > Preferences > Privacy
        Press the button “ Remove All Website Data”.
    3.  Turn off Extensions, if any.
         Safari > Preferences > Extensions
         Relaunch Safari.

  • Get the Current Quarter  and Current Week from date

    Hi,
    I want to get the Current quarter and Current week from a given date, which function modules should i use?
    I tried using function module - 'HR_99S_GET_QUARTER' for getting the quarter but it is throwing an error while loading data. Moreover it doesnt exist in BI7.
    Similarly for current week.
    Please help. Sample code snippets would be appreciated.
    Thanks
    Jaya

    You can use FORM time_conversion wich is the one used by standard in Update Rules:
    You can select whether convert 0CALDAY to 0CALWEEK or whatever infobject formats you prefer...
      perform time_conversion
                using  '0CALDAY'
                       '0CALMONTH'
                        p_input_date
                        l_fscvtval
                changing RESULT
                         c_t_idocstate
                         c_subrc
                         c_abort.
      if c_subrc <> 0 or c_abort <> 0.
        exit.
      endif.
    form time_conversion
                   using i_timnm_from type rsiobjnm
                         i_timnm_to   type rsiobjnm
                         i_timvl
                         i_fiscvarnt  type t009b-periv
                   changing e_timvl
                            c_t_idocstate  type rsarr_t_idocstate
                            c_subrc   like sy-subrc
                            c_abort   like sy-subrc. "#EC *
    data: l_timvl  type rsd_chavl,
          l_result type rsd_chavl.
      IF i_timvl CO ' 0'.
        CLEAR e_timvl.
        EXIT.
      ENDIF.
      l_timvl = i_timvl.
      CALL FUNCTION 'RST_TOBJ_TO_DERIVED_TOBJ'
        EXPORTING
          i_timnm_from             = i_timnm_from
          i_timnm_to               = i_timnm_to
          i_timvl                  = l_timvl
          I_FISCVARNT              = i_fiscvarnt
          I_BUFFER                 = rs_c_true
        IMPORTING
          E_TIMVL                  = l_result
        EXCEPTIONS
          INCOMPATIBLE_TOBJS       = 1
          NO_INPUT_VALUE           = 2
          FISCVARNT_MISSING        = 3
          INPUT_NOT_NUMERIC        = 4
          WRONG_DATE               = 5
          WRONG_FISCPER            = 6
          X_MESSAGE                = 7
          OTHERS                   = 8
      e_timvl = l_result.
    ENDFORM.                  "TIME_CONVERSION

  • Quarter of the Year

    Can anybody tell me how to get quarter of the year based on a given date.
    Thanx
    null

    Try:
    select to_char(sysdate,'q') from dual
    Steve

  • Date: showing the current quarter

    Hi,
    I want a field where you can chosse the current quarter. Is this possible? Has it something to do with date format? date.short, medium, long,...?
    Thanks in advance for helping me!
    Matthias

    First option:
    in Acrobat Pro I would write something like this (the "else" is still missing; second problem is that I can't make this for all years...)
    var 
    DatumsUhrzeitfeld4 = this.getAttribute("DatumsUhrzeitfeld4");
    if 
    (DatumsUhrzeitfeld4 = "August 2010"){DatumsUhrzeitfeld4
    = "Quartal 3"}
    if 
    (DatumsUhrzeitfeld4 = "September 2010"){DatumsUhrzeitfeld4
    = "Quartal 3"}
    if 
    (DatumsUhrzeitfeld4 = "Oktober 2010"){DatumsUhrzeitfeld4
    = "Quartal 4"}
    if 
    (DatumsUhrzeitfeld4 = "November 2010"){DatumsUhrzeitfeld4
    = "Quartal 4"}
    if 
    (DatumsUhrzeitfeld4 = "Dezember 2010"){DatumsUhrzeitfeld4
    = "Quartal 4"}
    Second option:
    http://forums.adobe.com/message/333985#333985
    Sorry, misread the issue. The Quarter will be based on the company you are working for . If their year-end is the same as a calendar yearend (Dec 31), then the example below will be accurate. Change the dates based on the company requirements.
    You can hardcode variables into your application.cfm page.
    quarter1start = "01-jan-";
    quarter2start = "01-apr-";
    quarter3start = "01-jul-";
    quarter4start = "01-oct-";
    The end of each quarter is programatically always the day before the start of the next quarter.
    I would add the 'year' to the equation dynamically, to keep it forward compatible.
    But where shall I write this?
    thx in advance 4 helping me!

  • Launch a procedure every quarter of the Year

    Hello:
    I need to launch a procedure every first day of a quarter of the year (JAN-01, APR-01, JUL-01 and OCT-01) I know that there is a package, DBMS_JOB, but I have no idea how can I used it, plese some one of yours have an example. Thanks
    Angel

    USER_EXPORT Procedures
    There are two overloaded procedures. The first produces the text of a call to re-create the given job. The second alters instance affinity (8i and after) and preserves the compatibility.
    Syntax
    DBMS_JOB.USER_EXPORT (
    job IN BINARY_INTEGER,
    mycall IN OUT VARCHAR2);
    DBMS_JOB.USER_EXPORT (
    job IN BINARY_INTEGER,
    mycall IN OUT VARCHAR2,
    myinst IN OUT VARCHAR2);
    Parameters
    Table 48-10 USER_EXPORT Procedure Parameter
    Parameter Description
    job Number of the job being run.
    mycall Text of a call to re-create the given job.
    myinst Text of a call to alter instance affinity.
    WHAT Procedure
    This procedure changes what an existing job does, and replaces its environment.
    Syntax
    DBMS_JOB.WHAT (
    job IN BINARY_INTEGER,
    what IN VARCHAR2);
    Parameters
    Table 48-11 WHAT Procedure Parameters
    Parameter Description
    job Number of the job being run.
    what PL/SQL procedure to run.
    Usage Notes
    You must issue a COMMIT statement immediately after the statement.
    Some legal values of what (assuming the routines exist) are:
    'myproc(''10-JAN-82'', next_date, broken);'
    'scott.emppackage.give_raise(''JENKINS'', 30000.00);'
    'dbms_job.remove(job);'
    Note:1. have start date hardcoaded 1st of next quarter and next date have it as ADD_MONTHS(trunc(sysdate,'q'),3) which is 1st day of every querter

  • Last date of the previous quarter

    Hi,
    How can i find the last date of the previous quarter, based on todays date (the fiscal year starting from 1st April)
    the quarters are 1st april to 30th June, 1st July to 30th sept, 1st Oct to 31st Dec and 1st Jan to 31st March

    872435 wrote:
    Hi,
    How can i find the last date of the previous quarter, based on todays date (the fiscal year starting from 1st April)
    the quarters are 1st april to 30th June, 1st July to 30th sept, 1st Oct to 31st Dec and 1st Jan to 31st MarchTry this function:
    select add_months(add_months(trunc(sysdate,'Q'),-1) - 1,1) from dual;
    Ion

  • Updated to Mavericks and I get the upper left quarter of the screen blacked out on Time Machine. This means that I can't see the files. Any suggestions for getting rid of the black square?

    Ive tried disconnecting and reconnecting the Time Machine. And I've tried rebooting the iMac, but I still get the top left hand quarted of the screeen blacked out. I can scroll back through the back-ups but the back square means that I can't see the details of any file.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, or by corruption of certain system caches. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled on some models, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output and  Wi-Fi on certain models. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Find the Current Quarter

    Hi All ,
    Is it possible to find the Months in current quarter based on the current date.
    Like months in this quarter are : April ,May and June .
    I just require to select the months in the  current quarter based on the current date.
    So if i run the same query in the month of July any date or September any date. ...
    The result should be July,August and September .
    Kindly Help

    You should create and use a calendar table as Jingyang suggests.
    However, if you MUST do it inline, this will get you where you need to be:
    select
    convert(date,convert(varchar,datepart(year,getdate()))+'-'+convert(varchar,(datepart(quarter,getdate())*3)-2)+'-01') as q_start,
    convert(date,convert(varchar,datepart(year,getdate()))+'-'+convert(varchar,(datepart(quarter,getdate())*3))+'-01') as q_end

  • How to populate the selected row details of table in the next view?

    hi,
    Im having a table, on selecting a particular row of a table by clicking on a radio button. i need that row details to be passed on(populated) to the next view when i navigate to that view by clicking on a button?
    Thanks & Regards,
    Suresh

    Hi Suresh,
    Your scenario is simple. Just follow the ex as shown below
    (Assuming you want default selection view provided by table itself.)
    1>Create 2 views (Ex:A and B)
    2>Create a Context with a node and attributes(For Ex:Person as node and Fname and Last Name as attributes
    2>In A view create a table with F name and L Name(map to context as well) and a action button to navigate to B view when you selected a particualr row o.k
    3>In B view, create a TextView with mapping to LastName(or all the data if you want from input selection) from the context
    If you want you can add back action button from B view to A view for easy navigation.
    4>Execute the application and select any row in the table appeared, press next action button,you can see that the selected row details will be shown in second(B) view.
    If you do the above example, I think you can easily find the solution for navigation issue.. try it out.
    In case if you are not able to ...let me know..I have that example.
    Hope that helps
    Regards
    Praveen

Maybe you are looking for