Quarter

Hi,
I need to get the last day (working day) of the prior quarter.
DateA is the date from my facttable, and DateB have values to use (history).
I use an expression operator to calculate the correct day
ID_DateB Between (TO_DATE(CONCAT('/01',
DECODE(WB_CAL_QTR("FT_INSTRUMENTOS"."ID_DateA "),1,'JAN',2,'APR',3,'Jul',4,'Oct'),
TO_CHAR("FT_INSTRUMENTOS"."ID_DateA ",'YYYY')))) - 8 )
AND
(TO_DATE(CONCAT('/01',DECODE(WB_CAL_QTR("FT_INSTRUMENTOS"."ID_DateA "),1,'JAN',2,'APR',3,'Jul',4,'Oct'),
TO_CHAR("FT_INSTRUMENTOS"."ID_DateA ",'YYYY')))) - 1 )
But OWB put the full statment directly in my joiner-where, and the "DECODE" don't work there
I need this operation in a nested select, how can change the query code??? or what operator I must use?? other way to do this??
---After set a range of day, I use a aggregator operator and use a MAX command in the having clause to return the last day of the prior quarter.---
Thanks

see if this function is of any help to you.
/* Formatted on 2009/02/11 22:06 (Formatter Plus v4.8.8) */
CREATE OR REPLACE PROCEDURE previous_records
AS
   CURSOR c1
   IS
      SELECT h_date
        FROM holiday;
   previous_date         DATE;
   previous_week_date    DATE;
   previous_month_date   DATE;
   previous_year_date    DATE;
BEGIN
   SELECT SYSDATE - 1
     INTO previous_date
     FROM DUAL;
   SELECT SYSDATE - 7
     INTO previous_week_date
     FROM DUAL;
   SELECT ADD_MONTHS (SYSDATE, -1)
     INTO previous_month_date
     FROM DUAL;
   SELECT ADD_MONTHS (SYSDATE, -12)
     INTO previous_year_date
     FROM DUAL;
   FOR c1rec IN c1
   LOOP
      BEGIN
         IF (TRUNC (previous_date) = TRUNC (c1rec.h_date))
         THEN
            SELECT (previous_date - 1)
              INTO previous_date
              FROM DUAL;
         END IF;
         IF (TRUNC (previous_week_date) = TRUNC (c1rec.h_date))
         THEN
            SELECT (previous_week_date - 7)
              INTO previous_week_date
              FROM DUAL;
         END IF;
         IF (TRUNC (previous_month_date) = TRUNC (c1rec.h_date))
         THEN
            SELECT ADD_MONTHS (previous_month_date, -1)
              INTO previous_month_date
              FROM DUAL;
         END IF;
         IF (TRUNC (previous_year_date) = TRUNC (c1rec.h_date))
         THEN
            SELECT ADD_MONTHS (previous_year_date, - 12)
              INTO previous_year_date
              FROM DUAL;
         END IF;
      END;
   END LOOP;
   DBMS_OUTPUT.put_line ('Previous Day is:' || previous_date);
   DBMS_OUTPUT.put_line ('Previous Week Day is:' || previous_week_date);
   DBMS_OUTPUT.put_line ('Previous Month Day is:' || previous_month_date);
   DBMS_OUTPUT.put_line ('Previous Year Day is:' || previous_year_date);
END previous_records;
/

Similar Messages

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • FR : How to change from monthly to YTD or quarter data in the same report

    Hi,
    We have several basic reports with 12 month in columns with monthly figures. We would like to try to improve these reports with 2 options (and not creating new reports):
    - For each month, we would like to choose between monthly & year to date figures. (we do not have a view dimension with YTD member)
    - In our period dimension we also have quarter members. How to choose between displaying month or quarter with the prompts ? (ie without having to select each month one by one)
    Does it is possible to do this with FR without adding a new dimension for monthly or YTD data?
    thanks!
    Tipiak

    Hi Tipiak,
    In order to show YTD Actual figure for the selected month, I was doing something like that
    - Add a hidden col from Jan to Run Time period selected.
    - Add a visible formula col and add the formula showing the total of the hidden col.
    Your requirement seems more complex but you might meet some part as an initial step maybe...
    Regards,
    Ahmet

  • Fiscal year period quarter in purchasing cube

    *Dear friends,*
    *I want to make one query on the basis of fiscal year  Qurterly . So please what is infobject in purchasing data cube is useful for making this query. Please guide me*
    *Thanks and Regards*
    *Anil*

    Hi,
    due to the fact that you dont want to use the quarter of the calendar year, you should build up an appropriate one and add it to the cube. Also you should fill it by formula or routine.

  • Asset Acquisitions (Mid-Quarter-Convention) Report

    Hello All,
    I am executing the report S_ALR_87012047 by which i am getting the US tax report in List form(display) and also i am giving the sort version as 7, by which i am getting the report in List format.
    But my query is i am able to see the US Tax report given in SAP Press release book as Grid Display and it is according to the Quarter wise they have displayed the report. Anyone help me out to display the report in Grid and with Quarter wise.
    For the above do i need to create a layout?
    Regards
    VEnk@

    The reports are based on complete fiscal year.
    You can have a look to the transaction:
    ARQ0 - Ad Hoc Reports
    The reports 27 and 28
    Then you can combine a standard report with this in EXCEL

  • Asset acquisition - mid quarter convention - USA

    Hi all,
    please help!
    I am worknig on MACRS depreciation for Asset.
    THe point is: we have different depreciation keys which must be applied depending if more then 40% of the all amount of asset of the year was acquired in the last quarter of the year.
    Question: since I can set as a default only one depreciation key, how can I switch it in the case that at the end of the year more then the 40% was acquired in the last quarter of the year? Must it be done manually or there is an automatic step in the system?
    Please help me
    Valeria

    Hi Valeria,
    As you rightly said, the decision to switch the key to a mid-quarter will be determined only at the end of the last quarter. When you have to change the key based on such determination, you can create a simple substitution rule for the depreciation key for the relevant depn, areas. Then, create a worklist for all the assets that fall under the mid-quarter convention by company code and use the substitution rule. Run a recalculate depreciation AFAR and new depreciation values will take effect.
    Thanks,
    Jagdish

  • Mid quarter depreciation without setting the mid period

    Hello All,
    Thank you for taking time to read my question.
    When AA went live, half monthly data for the company code was not maintained (while it should have been maintained 15 as the mid period). Since the half period is not configured, I am not able to set the mid month setting in OAVH. Now the taxes are calculated with an additional 15 days when specifying mid quarter when using period method control 005. The company code went live last year October and SAP will not allow updating the mid period from blank to 15.
    Have anyone dealt with such a situation? I planned on defining a new period control key and assign it to a custom period method control. But still not able to get the depreciation value correct to the mid quarter.
    Any help is greatly appreciated.
    AM

    What do you mean without mid period setting? Is this OAVH? Anyway, you can try this.
    Use of Half Months in the Company Code
    In this step, you determine the company codes in which you want to use half periods. In this way, you can calculate depreciation in these company codes on the basis of half months or half periods.  Using this method, you can work with 24 periods in Asset Accounting, although the fiscal year version in Financial Accounting has only 12 normal periods (without using a different fiscal year version for Asset Accounting).
    You should be aware, however, that the specifications for periods in the transactions in Asset Accounting (such as, useful life) have to be based on whole periods (12).
    Example
    Half periods are, for example, necessary to represent the "mid quarter/month rule". This is a version widely used in the U.S.A. With this rule, it is important for the determination of depreciation whether an acquisition takes place in the first or the second half of a period.
    Caution
    When you specify the use of half periods in the definition of an asset company code, half periods are automatically specified in all other company codes that use this fiscal year version.
    You cannot use half periods with non-calendar fiscal months.
    You cannot take back the use of half periods once the specification has been made.  It is noted internally by the system in the asset master records.
    Requirements
    The number of the posting periods in the fiscal year version used must correspond to the number of calendar months (12).
    Activities
    1. Specify the use of half periods by entering the date (for example, the 15th) for the middle of the period for the company codes.
    2. If you have defined period controls yourself
    (see Period Control),
    you must provide for the use of half periods in their assignment rules. For monthly and quarterly periods, corresponding period controls have already been created as standard in the system.
    Thanks!
    Jhero

  • Payroll scheme - quarter and semi-annual payments

    Hi.
    I have the following questions concerning Payroll scheme I am working on.
    How can I check the following conditions?
    1. A wage type (WT) for quarter payment has not to be paid to a worker if he was hired during the last month of a quarter. For example, a worker was hired in September 01, 2011 - thus, in September a WT shouldn't be paid to him, 'cause September is the last month of a 3rd quarter.
    2. Another WT for semi-annual payment has not to be payed to a worker if he has been hired during the last 2 months of a half year period. For example, the worker was hired in November 01, 2011 - thus, in November and December a WT for semi-annual payment shoudn't be paid to him.
    Please, give me any tips to solve the issue, thank you.

    rkvarma,
    with which function will I be able to determine the months to start from?
    I want to make the following:
    - for quarter payments - to determine months 3, 6, 9, 12, and if employees were hired during these months, then the WT shouldn't be paid.
    - for semi-annual payments - to determine months 5,6 and 11,12, and if employees were hired during these months, then the WT shouldn't be paid.
    How to do this?

  • HT1212 My ipad mini has been crashing a lot recently so I started a system reset. However, it's now stuck with the progress bar less than a quarter gone: this has been the case for several days now. I have tried resetting from itunes but it needs the pass

    Now it's stuck with the progress bar less than a quarter full. I have also tried resetting through itunes which works right up to the point where itunes states that it needs the passcode to be inputted into the ipad to connect to it. At which point it then sticks at the same progress bar point. HELP!! please, this ipad is really important to my work.

    Well the term "hotlined" I have never heard before. In any case many states (like NY) just passed regulatory powers to the State Public Service Commission of which it may be called something different in your state. You could file a complaint with them. Or file a complaint with your state attorney generals office, they also take on wireless providers.
    The problem here is the staff you speak to are poorly trained, in days gone by it took one call to them and they pulled up your account and see the error and had the authority to remove any errors. They did not remove legitimate account actions, but used their heads instead of putting a customer off or worse lying to the customer.
    Its a shame you have to go through what you going through.
    Good Luck

  • Balance sheet required for current quarter and previous quarter

    Hi Guys,
                 I am using 0FIGL_C10 cube for balance sheet report,i need to create balances for current quarter and previous quarter.
    user will enter the fisper, based on fisper it has to show the current quarter and previous quarter balance.
    how to calculate the quarter using fisper.

    you can use offset with ranges.
    or
    just offset of -1 , -2 & -3 seperately in 3 selections and add it in one column in formula (this will give u current quarter).
    similarly offset of -4, -5 , -6 will give u previous quarter result.
    total of 6 selection and 2 formulas. hide all selections from display.

  • Queries for current Qtr and prior quarter

    If I select one date in dashboard prompt in one column I want to display current quarter revenue and prior Qtr revenue.
    Could anyone give me the queries for the current Qtr and prior Qtr?
    So I will going to use presentation variable from the dashboard prompts

    obiee-date-expressions-reference
    Date Calculation OBIEE Expression Explanation :
    First Day of the Previous Year
    TIMESTAMPADD( SQL_TSI_YEAR , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD removes a year from the returned date for the First Day of the Previous Year.
    First Day of the Current Year
    TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This calculation returns the first day of the year by deducting one less than the total number of days in the year.
    First Day of the Next Year
    TIMESTAMPADD( SQL_TSI_YEAR , 1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD adds a year to the date returned which will give the first day of the next year.
    First Day of the Previous Month
    TIMESTAMPADD(SQL_TSI_MONTH, -1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD then subtracts one month from the first day of the Current Month arriving to the First Day of the previous month.
    First Day of the Current Month
    TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This expression gets the current day of the month and subtracts one less than the current day to arrive at the first day of the month.
    First Day of the Next Month
    TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD then adds one month from the first day of the Current Month arriving to the First Day of the next month.
    First Day of Current Quarter
    TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This was included to show the calculations discussed above can be used with other functions. This is the same expression as the one that returns the first day of the current month except this one uses the DAY_OF_QUARTER property to return the first day of the current quarter.
    Last Day of the Previous Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD subtracts a month to arrive at the first day of the previous month.
    Last Day of Current Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD finds the first day of the current Month. The second TIMESTAMPADD adds one month to the date to arrive at the first day of the next month. The final TIMESTAMPADD subtracts one day from the returned date to arrive at the last day of the Current Month.
    Last Day of the Next Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 2, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD finds the first day of the current Month. The second TIMESTAMPADD adds two months to the date to arrive at the first day of month after next. The final TIMESTAMPADD subtracts one day from the returned date to arrive at the last day of the Next Month.
    Last Day of Previous Year
    TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1,
    CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD subtracts one day to arrive at December 31st of the previous year.
    Last Day of Current Year
    TIMESTAMPADD(SQL_TSI_YEAR, 1, TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD deducts one day to arrive at December 31 of the previous year. The third TIMESTAMPADD adds a single year to the date to arrive at December 31 of the Current Year.
    Last Day of the Next Year
    TIMESTAMPADD(SQL_TSI_YEAR, 2, TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD deducts one day to arrive at December 31 of the previous year. The third TIMESTAMPADD adds 2 years to the date to arrive at December 31 of the Next Year.
    Last Day of Current Quarter
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_QUARTER , 1, TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) Demonstrated using Quarters. From right to left the first TIMESTAMPADD returns the first day of the Current Quarter. The second TIMESTAMPADD returns the first day of the next quarter. The final TIMESTAMPADD subtracts a single day from the date to arrive at the last day of the Current Quarter.
    Number of days between First Day of Year and Last Day of Current Month TIMESTAMPDIFF(SQL_TSI_DAY, CAST('2010/01/01 00:00:00' AS DATE), TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)))) For simplicity I hard coded the January 1, 2010 date and CAST it to a date. I could have used the First Day of the Current Year calculation but didn’t want to over clutter the example. The second part of the TIMESTAMPDIFF uses Last Day of the Current Month calculation to force the TIMESTAMPDIFF to calculate the number of days between the first day of the year and the last day of the current month.
    =============
    FYI, let say some example,
    Last day of previous Quarter:
    "GPC_DataMart"."GPC_DataMart"."dbo"."LQ_Position"."Business_Date"=TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Last month last day:
    "GPC_DataMart"."GPC_DataMart"."dbo"."LM_Position"."Business_Date"=
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Last year Last day
    "GPC_DataMart"."GPC_DataMart"."dbo"."LY_Position"."Business_Date"=
    TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Thanks and Regards,
    Deva
    http://obieeelegant.blogspot.com/2011/06/obiee-date-expressions-reference.html

  • Calculation of total depending upon the quarter selected

    Dear All,
    User want to see the quarterly total of all the amount.
    Key figure struture in report is:-
    Quarter
    Actual amount
    plan amount
    variance
    This will display the result for every quarter. Now user want to see the quarter total.
    I can achieve this by making the property of CALQUARTER to suppress results never. This will give me output at the end of everyquarter. But i have variance field in my report whichi is giving a problem.
    Say for 1st three posting period the variance is 100 respectively then the quarterly variace is coming as 300 total. I dont want this . I want to apply formula here.
    formula=(( actual variacne - plan variance)/plan variacne)*100.
    How can i achieve this in BEx?
    Thanks & Rgds,
    Anup

    Hi Moorthy,
    variance is a formula.
    Quarter object used in hte key figure struture is a characteristics so i can't specify calculate result as total it only applies to key figures. For characteristics there is an option called Normailze to :- 'No normalization, Query result, Overall result, and Resul'. I dont know if we can use any of these???
    Suppress results never will automatically take the summation only.
    Thanks & Regards,
    Anup

  • Re: i was charging my iphone 3GS yesterday in electricity when once it turned off suddenly while it was in quarter battery. I tried charging it again but it didint open, i tried to plug it into my laptop but itunes didnt recognize it and it doesnt work.

    Re: i was charging my iphone 3GS yesterday in electricity when once it turned off suddenly while it was in quarter battery. I tried charging it again but it didint open, i tried to plug it into my laptop but itunes didnt recognize it and it doesnt work.

    Hello candymerna,
    At this point I would recommeng resetting the device if if will not turn on.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    From: iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
              http://support.apple.com/kb/ht1430
    If it does turn on, but will not charge then take a look at this part of the article iPhone: Hardware troubleshooting found http://support.apple.com/kb/ts2802
    Power/Battery
    Battery does not charge from the USB power adapter
    Important: Only original iPhone can be charged from a FireWire-based power source. If iPhone is connected to a computer that's turned off or is in sleep or standby mode, the battery may drain.
    Verify that the outlet being used is working.
    Try another USB power adapter if available.
    If no other USB power adapter is available, try connecting to a high-power USB 2.0 port (not a keyboard). The computer must be turned on and not in sleep or standby mode.
    Try another USB cable if available.
    Also refer to iPhone and iPod touch: Charging the battery.
    If it is charging, but not recognized in iTunes take a look at one of these articles depending on your Operating System.
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    or
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/ts1591
    Cheers,
    Sterling

  • I was charging my iphone 3GS yesterday in electricity when once it turned off suddenly while it was in quarter battery. I tried charging it again but it didint open, i tried to plug it into my laptop but itunes didnt recognize it and it doesnt work. help

    i was charging my iphone 3GS yesterday in electricity when once it turned off suddenly while it was in quarter battery. I tried charging it again but it didint open, i tried to plug it into my laptop but itunes didnt recognize it and it doesnt work. help plzzz

    Hello candymerna,
    At this point I would recommeng resetting the device if if will not turn on.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    From: iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
              http://support.apple.com/kb/ht1430
    If it does turn on, but will not charge then take a look at this part of the article iPhone: Hardware troubleshooting found http://support.apple.com/kb/ts2802
    Power/Battery
    Battery does not charge from the USB power adapter
    Important: Only original iPhone can be charged from a FireWire-based power source. If iPhone is connected to a computer that's turned off or is in sleep or standby mode, the battery may drain.
    Verify that the outlet being used is working.
    Try another USB power adapter if available.
    If no other USB power adapter is available, try connecting to a high-power USB 2.0 port (not a keyboard). The computer must be turned on and not in sleep or standby mode.
    Try another USB cable if available.
    Also refer to iPhone and iPod touch: Charging the battery.
    If it is charging, but not recognized in iTunes take a look at one of these articles depending on your Operating System.
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    or
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/ts1591
    Cheers,
    Sterling

  • How to get week & quarter for entered date

    I need help on below query
    1) when i enter date, it should bring previous & further week of that month. As per my requirement my week starts from Saturday to Friday. Lets say that i am entering 24.01.2006, then it should bring week 1 from 7th Jan to 13th Jan 206, 14th Jan to 20th Jan 2006 & so on.
    2) Similarly when i enter date as above , i want data coming on quarter basis instead of week..
    I will be highly thankfull to you for the help..
    Regards
    [HASAN]

    HI
    try HR_99S_GET_QUARTER.
    type-pools: p99sg.
    data: l_week type P99SG_QUARTER.
    CALL FUNCTION 'HR_99S_GET_QUARTER'
      EXPORTING
        IM_DATE             = sy-datum
      IM_ABKRS            =
      IM_PERMO            =
    IMPORTING
       EX_QUARTER          = l_week.
      EX_RETURNCODE       =
              write:/ l_week-begda.
               write:/ l_week-endda.
    Message was edited by: Harikishore Sreenivasulu

  • How to get the first and second quarter from CRT

    Dear Freinds,
                    I have one scenario , the Functional SPEC says Read the payroll results and from the CRT  get all the 4 quaters
    for the wage type /5UH  and sum them and then pass on the to field in the main strucutre.
    Iam using the FM HR_GET_PAYROLL_RESULTS
      CALL FUNCTION 'HR_GET_PAYROLL_RESULTS'
        EXPORTING
          pernr                         = fp_v_pernr
          permo                         = fp_v_permo
          pabrj                         = fp_v_pabrj
          pabrp                         = fp_v_pabrp
          actual                        = 'A'
        TABLES
          result_tab                    = i_payresult
        EXCEPTIONS
          no_results                    = 1
          error_in_currency_conversion  = 2
          t500l_entry_not_found         = 3
          period_mismatch_error         = 4
          t549q_entry_not_found         = 5
          internal_error                = 6
          wrong_structure_of_result_tab = 7
          OTHERS                        = 8.
    Iam collecting all the Actual Result (current result) values
    on the selection screen iam passing for month april (04 2008)
    so this falls in the second quater .
    the internal table   i_payresult is picking up only the second quater (01-04-2008 to 30/04/2008 )  ,but since on the selection screen iam pasing as other period (04 2008) the internal table  i_payresult  returing from the FM  (HR_GET_PAYROLL_RESULTS) only   picks the second quater,
    could any one let meknow how i can pick up the first quarter as well and add the first and second quater to mee the requirement .
    Please help me in this regard
    Thanks & regards
    maduri

    Hi Manoj,
                 Thank you for giving me idea for going further  regarding this problem , so my final question for this is
    as per FS they said they are going to enter the payroll
    area and the other selection as 04 2008 
    In order to achieve the first quarter , because 04 2008 means they are going to enter for the second quarter , the payroll results will come only for second quarter and not for the first quater , if they want to sum all the two quarters then they shouldnt pass on the selection screen   the dates as 04 2008, instead they has to pas
    01 01 2008 to 30 06 2008 , as there is no point in they passing as 04 2008 as we are going to consider from 01 2008 to 062008 .   Please correst me if am correct regarding the dates passing on teh selection screen
    or if the user enters on theslection screen still enter 04 2008 and will be  able to acheive the first quarter ??
    Please answer me this point before i can change the logic of the code and tell to my FO regarding this point.
    thanks & regards
    Madhuri

Maybe you are looking for