Show data of last day of previous month against any day of current month

Hi,
I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
Any suggestion ???

You're asking to filter your data set to only include rows between:
1) last day of the previous month
2) any day of the current month
This can be achieved with prompting in OBIEE Answers.
last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
For the 'last day of previous month' , use the query:
SELECT
case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
end
FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
For the current date, use the query:
SELECT
case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
end
FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

Similar Messages

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • 28th day of the previous month to 27th of the current month

    Hi,
    I am designing a report wherein the data should range from 12:01am on the 28th day of the previous month to 11:59 pm on the 27th of the current month.. This should be a dynamic one as this would be scheduled.
    Any help will be greatly appreciated!
    Thanks & Regards
    BMC

    Hi
    Thanks for your reply and I have been using the same formula given by you but unfortunately it stopped giving the result.  This is how i have given the syntax:
    Create a new field name say From (this will calculate all the data of preceding month starting from 28th)
    if not(month(CurrentDate)=1) then
    date(year(CurrentDate),month(CurrentDate)-1,28)
    else
    date(year(CurrentDate)-1,12,1)
    Creat an another field say To (this will calculate all the data of current month as of 27th)
    if (month(CurrentDate)=1) then
    date(year(CurrentDate),month(CurrentDate),27)
    else
    date(year(CurrentDate)-1,12,1)
    Now create one more field say Time that will include the above two syntaxes.
    {CHG_Change.Considered Res Time}>DateTime({@From}) and {CHG_Change.Considered Res Time}<=DateTime({@To})
    This did work  but seems now its not working.. Can you see if am missing out something here..
    Regards
    Cauvery

  • SSRS Matrix report. Variance expression by Month. Need to compare month from prior year to current month of current year VS2010

    Please help.  I have a matrix report.  In the report I have row group  PO Type.  One the Column groups I have a parent group by Fiscal Year, and then a child group by Month.  When I run the report, I get two years of data back broken
    out by month.  Please see below.
    Now here is where I am getting stuck.  I need to take the variance between the current month of the current year, from the same month of the prior year.  So I need to show the difference between Oct , 2014 from Oct, 2013. November, 2014 from November
    2013... etc. etc.
    In the example below, how do I create a column or row showing the variance for Contracts for October 2014.  I need to take the contracts for October 2014 which is 3 and subtract that from October 2013 which is 8.  Any suggestions? How do I do that
    for each month?  Then I need to do it for the quarter... then the year?  But I'll be happy if I can just get the month working first.
    Any help will be appreciated. 
    here is what my rdl file looks like.
    Here is what my report looks like when I render it.

    Hi Adrian_s2012,
    According to your description, you want to compare values for the month of current year with the month of prior year and get the variance. Right?
    In Reporting Services, we don't have any function to get this "Year to Year" Growth. In this scenario, if you data source is a cube, we suggest you use Analysis Services to achieve your requirement. If this data source is just from database, it will be hardly
    to calculate the variance because we need to compare the values within every two different column group and matrix generate adjacent columns one by one. Even we make it by using custom, every time executing the long code when generating result
    in a cell will reduce a lot of performance, we really don't suggest to do that in SSRS. Here is a thread with much easier requirement, please take a reference of that:
    http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Want to custom repeat monthly on any day but related to a specific day, e.g. 'repeat monthly on the Thursday following the first Sunday'.

    I am using Calendar Version 7.0 (1841.1).  OSX 10.9.3
    I know you can easily do, say, 'repeat monthly on the first Thursday of the month'. 
    What I want to do is create a monthly pattern of events in weekly chunks, related to the Sundays in the week. 
    (yes, that means you get the occasional 5th week free! Hurray!)
    I saw something on another thread (for a different issue) about dragging the event to the desktop, opening in text edit and altering the code - happy to do that (well relatively!) if there is an expression that would get the right result - thinking of something along the lines of  - monthly, frequency 1, by day, Sunday1 +4.  Possible?!

    In the second para it should read 'Sundays in the month' - not week  ;-)

  • Since getting os5 my calendar is blank until i go back a month, then return to the current month and everything appears. Anyone else having this problem?

    First time submission. Sorry if I'm doing it wrong.

    Others have reported that problem.
    If you want Apple to know report it at: http://www.apple.com/feedback/ipad.html

  • Last day of previous month for data load

    Hi,
    I have to load data from the previous month into the psa and then into an infocube. I was wondering as to how to get the last of the previous month to write a code in ABAP. I will be writing the code at the infopackage level in the data selection. I could load data from the 1st of the previous month to the 1st of the current month. This will be an additional load of 30,000 records for the 1st of every month, since I will be loading 30,000 records everyday, I was wondering if I could limit the load from the 1st of every previous month to the last day of that month. This will be a repetitive loading.
    DATA: CURR_MM(2) TYPE N,
    CURR_YYYY(4) TYPE N,
    CURR_DD(2) TYPE N,
    PREV_MM(2) TYPE N,
    PREV_YYYY(4) TYPE N,
    PREV_DD(2) TYPE N,
    YYYY_MM(6),
    YYYY_MM1(6),
    DATE LIKE SY-DATUM.
    DATE = SY-DATUM.
    CURR_YYYY = DATE+0(4).
    CURR_MM = DATE+4(2).
    CURR_DD = DATE+6(2).
    PREV_DD = 1.
    IF CURR_MM = '01'.
    PREV_MM = '12'.
    PREV_YYYY = CURR_YYYY - 1.
    ELSE.
    PREV_MM = CURR_MM - 1.
    PREV_YYYY = CURR_YYYY.
    ENDIF.
    concatenate PREV_YYYY PREV_MM PREV_DD into YYYY_MM.
    concatenate CURR_YYYY PREV_MM PREV_DD into YYYY_MM1.
    read table l_t_range with key
    fieldname = 'BLDAT'.
    l_idx = sy-tabix.
    l_t_range-low = YYYY_MM.
    l_t_range-high = YYYY_MM1.
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.
    p_subrc = 0.
    Mind you this code will load data from 1st of the previous month to the 1st of current month. I just don't want to load that extra "1st day" of current month data as I have 30,000 records everyday.
    Say for example, I want to load data from 1st Mar to 31st Mar or 1st Feb to 28thFeb. How should I modify the above code.
    Is there a formula to get the last date of the previous month. That's all I need. This would solve the problem.

    try this routine. it will return a range from 1st day to end of the month.
    DATA: l_s_range TYPE rsr_s_rangesid,
              E_T_RANGE TYPE  RSR_T_RANGESID.
    DATA: year(4) TYPE n,
          month(2) TYPE n,
          day(2) TYPE n,
        ld_keydate  TYPE sydatum,
          ld_lastday  TYPE sydatum.
      REFRESH e_t_range.
      CLEAR l_s_range.
      year  = sy-datum(4).
      month = sy-datum+4(2).
    *Months with 31 days in year
      IF month = '01' OR
         month = '03' OR
         month = '05' OR
         month = '07' OR
         month = '08' OR
         month = '10' OR
         month ='12'.
        day = '31'.
      ENDIF.
    *check for leap year: provoking sy-sybrc <> 0
      IF month = '02'.
        day = '29'.
        MOVE:   '02'        TO ld_keydate+4(2),
                year        TO ld_keydate(4),
                day         TO ld_keydate+6(2).
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            date   = ld_keydate
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <> 0.
          day = '28'.
        ENDIF.
      ENDIF.
    *months with 31 days in year
      IF month = '04' OR
         month = '06' OR
         month = '09' OR
         month = '11'.
        day = '30'.
      ENDIF.
      MOVE: year              TO ld_lastday(4),
            month             TO ld_lastday+4(2),
            day               TO ld_lastday+6(2).
      l_s_range-low  = sy-datum.
      l_s_range-high = ld_lastday.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      APPEND l_s_range TO e_t_range.

  • How to get the data for last 3rd business day and also include saturday and sunday if its a wednesday?

    Hi All,
    I have a simple query which is below:-
    Declare @reportdate date
    set @reportdate= (DATEADD(dd,-5,getdate()))
    select * from dbo.Table
    where date IN (@reportdate)
    I need this query to pull the data for the last 3rd business day .So lets say today is monday then i need the data for last week wednesday which is 3 business days back from monday, if today is a tuesday it would be for last thursday ( as 3 business days for
    tuesday would be thursday). But if today is wednesday then i need to be last 3rd business day which is last friday and i also need to get the data for saturday and sunday.
    Can someone please help me how cani change my filter to do this?
    Please let me know if i am still unclear.
    Thanks

    Hi SqlDev12,
    Based on my understanding on your requirement, you can reference the below sample.
    CREATE TABLE BusinessTable
    Bdate DATE,
    Wd VARCHAR(10)
    ;WITH Cte(DT,WD) AS
    SELECT CAST('20150401' AS DATE),DATENAME(WEEKDAY,CAST('20150401' AS DATE))
    UNION ALL
    SELECT DATEADD(DAY,1,DT),DATENAME(WEEKDAY,DATEADD(DAY,1,DT)) FROM Cte
    WHERE DT<GETDATE()
    INSERT INTO BusinessTable SELECT * FROM Cte
    SELECT * FROM BusinessTable
    SET DATEFIRST 7 -- Set Sunday as the first day of a week
    DECLARE @givenDay DATE ='20150415' --Wednesday
    SELECT * FROM BusinessTable
    WHERE Bdate BETWEEN
    --For Monday and Sunday, select last wednesday
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    --For Tuesday and Wednesday, last week's Thursday and Friday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3,4) THEN DATEADD(DAY,-5,@givenDay)
    --For Thursday and Friday, current week's Monday and Tuesday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    --For Saturday, current week's Wednesday
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    AND
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3) THEN DATEADD(DAY,-5,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(4) THEN DATEADD(DAY,-3,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    DROP TABLE BusinessTable
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • Is there any standard variable to calculate previous and current month

    hi,
    Is there any standar variable to calculate previous month and current month which will calcualte from system date (sy-date). I found standard SAP Delivered variable - 0CMONTH to calculate current month. But i want both current month and previous month.  IF it is not avialble can you please provide me the ABAP code..
    thanks in advance.

    Hi,
    Check this thread.
    ABAP routine for loading previous months data in infopackage
    Regards.

  • Formula to subtract current month from previous month

    Hi
    I would like to how to subtract current month from previous month in Crystal 10.  Basically am looking at the variations that between the two month .   I would also like to know the 12 m onth rolling data formula.  Using the same formula, you need to get the difference between the two month.
    Any help on this is very much appreciated.
    Thanks
    Regards
    Cauvery

    Hi Thanks for reponding.
    Though the formula is correct, I don't think it will work out in that way because I have a 12 months rolling data  formula and using this formula  I have to subtract the current month from previous month.
    This the formula that am currently using for 12 months rolling data
    {HPD_HelpDesk.Arrival Time} >= DATEADD ("yyyy", -1, CURRENTDATE)
    Please advise.
    Regards
    Cauvery

  • Date of Last Delivery incorrect in EKEK (sometimes)

    Hello!
    When I go into ME39 and into the Release Documents, I have correct dates for Last GR (EKEK-LWEDT) but for Last Delivery, it shows me the date (and number) of what was probably the first Delivery received for that contract. (EKEK-LFDKD / LFNKD)
    See picture below, notice the inconsistencies. The first wrong case happened in the release generated December 6th 2013, as shown in picture below.
    Then starts happening more often in January 2014, and surprisingly in the release generated April 3rh, 2014 the number is correct...
    I have already checked these 2 notes, mentioned in the only post about this issue (from 2011), but they are already implemented in my system, since we have 604, SP 14
    1337084 Release header contains doc. date instead of delivery date
    1309001 Incorrect date for last goods receipt in sched. agreement
    Any help would be greatly appreciated!
    Thanks!
    Gabriel Andrade

    Hi,
       Seems the note: 1309001 - Incorrect date for last goods receipt in sched. agreement exactly deals the same issue. But if the note is already implemented and the issue is not solved, you may check the note: 1465118 - Release header: Incorrect date or quantity of last GR
       If its not solved and you couldnt find any relevant notes, you may raise an OSS ticket to SAP.
    Regards,
    AKPT

  • Calculate Dates for Last week and next three weeks

    Hi,
    I have a report where I need to calculate dates between last week and the next three weeks (not counting current week). I'm familar with the first part, it could be done by using the LastFullweek function but not sure how I can avoid the current week and calculate the next three weeks.
    Any help is greatly appreciated.
    Thanks!

    ... and here are a few more...
    Last Week...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    THEN TRUE ELSE FALSE
    The week before...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    THEN TRUE ELSE FALSE
    And the week before that...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    and of course all 3 weeks together...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    If you want the 1st day of the week to be Monday instead of Sunday just change the date of #1/7/190# to #1/1/1900#
    HTH,
    Jason

  • Check if date falls in current month

    Hi All,
    How to check if a date value falls within the current month or its older than current month in a simple logic? I have to do this without using too complicated a logic..
    Thanks in advance.

    Hi ,Check This
    SQL> select to_number(to_char(sysdate,'mm')) today,to_number(to_char(sysdate-1,'mm')) yesterday,case
    to_number(to_char(sysdate,'mm'))-to_number(to_char(sysdate-1,'mm'))
      2  when 0 then 'Same Month'
      3  else 'Different Month' end months from dual;
         TODAY  YESTERDAY MONTHS
             1          1 Same Month
    SQL> select to_number(to_char(sysdate,'mm')) today,to_number(to_char(sysdate-30,'mm')) yesterday,cas
    e to_number(to_char(sysdate,'mm'))-to_number(to_char(sysdate-30,'mm'))
      2  when 0 then 'Same Month'
      3  else 'Different Month' end months from dual;
         TODAY  YESTERDAY MONTHS
             1         12 Different MonthRegards
    Umi

  • Mobile Email not retrieving messages for current month

    I did a couple of quick searches on this problem, but I couldn't find any information if this is a known bug with the Mobile Email application.  For the last week or so, whenever I access Mobile Email on my LG enV Touch, the first page of emails shown are for the previous month, but the same day of the month (so today is August 16th, 2010, and the newest messages I can access are from July 16, 2010).  There is no software update available.  From the application's info page it seems like my version is 3.1.3.2.
    Also, the email address that is being accessed is for an @comcast.net account, but this setup has been working fine for over a year now, until this issue came up. When I access this account elsewhere, it does show messages for the current day, like normal.
    Has anybody seen a problem like this?  Any suggestions for next step on looking into this?
    Thank you.
    - Wes

    I do apologize that you are not able to retrieve any of the current months emails.from your device.However you may need to re download the mobile email application in order to get the emails to start coming through. Here are some steps to downloading the mobile email application from  your device. Hope this helps!
    From the main screen, select Menu.
    Select Media Center (Get It Now).
    Select Browse & Download (Tools on the Go).
    Select Get New Applications.
    Select Mobile Email.
    Select the purchase option.
    If prompted, select Yes to start the download.
    Select Yes.
    To continue the installation, review the Terms of Use, then select Accept.
    Select the desired email provider, then choose Select.
    If prompted, review the Terms of Use for the email provider, then select Accept.
    Enter the username and password, then select Sign In.
     Username and password are case sensitive

  • Macro should only be executed for periods of current month

    Hello Experts,
    I am using fiscal year variant (FW) in which 4 periods exist for any month. Whenever I open the planning book, I will have to see only these 4 periods of the current month and Initial bucket.
    I have a macro, that should be executed for all these 4 periods of the current month at any time during the month.
    (aggregated sum of forecast of period 1 and 2 will be shown in bucket 2. aggregated sum of period 1,2 and 3 are shown in bucket 3, etc)
    So, I have designed the time bucket profile with past as 1 month of Fiscal year variant FW and future of 1 month of Fiscal year variant.
    My time bucket profile is 1 month - split into 4 periods of fiscal year FW.
    1) The macro runs fine if the current system date lies in the second period through fourth period. But during the beginning of the month, when it is in the first fiscal period of month, it displays past 4 periods as 4 periods of previous month and 4 future periods of current month. I just want to display all buckets or periods of current month only. How can I achieve this?
    2) So, during first week of the month, my macro runs only for past 4 periods and not for future 4 periods. But I want to run only from 1st period of current month till last period of current month. How to achieve this? Is there any macro function to overcome this? Or is there any standard configuration to avoid this problem?
    Thanks,
    Suresh

    Hi Marius,
    Thanks again. But, the macro code that I write, should be executed from the first period of current month to the last period of current month, even though, if the current system date is in the third period of the current month.
    Also the interactive planning grid should show all the periods of current month as visible, even though I'm not in the first period of current month.
    Thanks and Best Regards,
    Suresh

Maybe you are looking for