Get previous year from leap year

Hi all,
I'm stuck here trying to get the previous year for the current year, I tried these function module but didn't work, CCM_GO_BACK_MONTHS and CALCULATE_DATE.
The problem is, in the leap year, there's Feb 29th, so I want to get 1 year before the date I enter, 2008 is a leap year, when I entered feb 29th 2008, then used the FM, then it showed me Feb 29th 2007, but 2007 doesn't have Feb 29th.
Any advice? thanks!

Try                                                                               
/SAPNEA/J_SC_CALENDAR          Calendar
/SAPNEA/JSC_LEAP_YEAR          Leap year check between two date
                                                                                EAU0
ISU_LEAP_DAYS_BETWEEN_2_DATES
                                                                                FF04
FIMA_LEAP_DAYS_BETWEEN_2_DATES
                                                                                FV02
LEAP_DAYS_BETWEEN_TWO_DATES                                  
You can also look at class "CL_HRSEN00_LEAP_DAY_TOOLS"
^ Saquib

Similar Messages

  • What is the best way to get Previous Year calculations?

    Hi. I am having trouble building Previous Year calculations in OBIEE 11g. The "Ago" function is not working for me. At my company previous year is defined as Date - 364 (not Year - 1).
    Here is an example of the Answers report I am trying to build:
    Division    Store    Week    UPC     ItemQtySold     ItemQtySold-LY
    Because I am building my Ago function at the Day level, and reporting at the Week level, it is not working properly.
    Does anyone have any suggestions?
    Thanks,
    Mike

    Hi,
    Just create an evaluation tenate and get your hands Dirty! Or if you are a partner to Microsoft, you can register yourself at
    http://portal.fasttrack.office.com and then you can create sites from there. If you need tenant with data, use
    http://microsoftcie.com and create a tenant, then you will have your own contoso to play with! :) 
    Regards
    Henrik A. Halmstrand
    sharepointrevealed.com
    getspconfig.codeplex.com
    Please click Mark As Answer; if a post solves your problem or Vote As Helpful; if a post has been useful to you.

  • Getting Previous year Data

    Hi,
    My db has following:
    Year Sales Target (10 % more of Previous year's Sales)
    2007 10000 -
    2008 15000 11000
    2009 18000 19500
    2010 20000 19800
    2011 10000 22000
    I have a filter set to retrieve data for Current Year and (Current - 3) years, and I get following
    Year Sales Target (10 % more of Previous year's Sales)
    2008 15000 0
    2009 18000 19500
    2010 20000 19800
    2011 10000 22000
    I want to display the value (Target) for 'Year 2008' (as the previous year sales data is present);
    Is it possible to get it?
    Regareds,
    Jitendra

    Matt!
    Would you please explain, how to achieve this in Pivot?
    Regards,
    Jitendra

  • Getting previous value from previous row

    Hi,
    My desired output should be
    ID     Book_date     Credit     Previous_Credit
    123IT1     12/8/2008     100800     72500
    from this table:
    ID     Book date     Credit
    123IT1     12/8/2008     100800
    123IT1     12/18/2007     72500
    123IT1     11/14/2006     150720
    I tried to use the lead function but I'm having problem when I included the date range condtion:
    This is my query:
    select id, book_date, credit, lead(credit) over (order by rownum) as previous_credit
    from t
    where book_date between '01-December-2008' and '31-December-2008'
    Result
    ID     Book_date     Credit     Previous_Credit
    123IT1     12/8/2008     100800     
    The previous_credit column is always blank. I think because of the date range..?
    Any idea how to get the right result? pls. help

    Your expected output indicates that you may require a LAG
    SQL> with t as
      2  (
      3    select '123IT1' id, to_date('12/08/2008','mm/dd/yyyy') Book_Date, 100800 Credit from dual uni
    on
      4    select '123IT1', to_date('12/18/2007','mm/dd/yyyy'), 72500 from dual union
      5    select '123IT1', to_date('11/14/2006','mm/dd/yyyy'), 150720 from dual
      6  )
      7  --
      8  select id
      9        ,Book_Date
    10        ,Credit
    11        ,lag(Credit) over (partition by id order by Book_Date) Previous_Credit
    12  from t
    13  /
    ID     BOOK_DATE     CREDIT PREVIOUS_CREDIT
    123IT1 14-NOV-06     150720
    123IT1 18-DEC-07      72500          150720
    123IT1 08-DEC-08     100800           72500If you always require a Previous Credit then you may want to modify this:
    (partition by id order by Book_Date)to this:
    (order by id, Book_Date)

  • Actual - Previous Year not summing correctly

    Hi,
    I've tried two different MDX expressions to return the Actual GSV for this period last year.  They both work for individual periods but they don't sum correctly.
    Ie if you review the results for several periods in Excel then as long as the periods appear across or down the page the results are correct. However if Period is the Page Grouping (the Filter) then the result is wrong.
    The first expression doesn't return a total at all:
    Create Member CurrentCube.[Measures].[Actual - Gross Sales PY]
    As 
    ([Measures].[Actual - Gross Sales], 
    ParallelPeriod(
    [Date].[Period Hierarchy].[Fin Yr],1,
    [Date].[Period Hierarchy].currentmember)),
    NON_EMPTY_BEHAVIOR = { [Actual - Gross Sales] }, 
    VISIBLE = 1 ,  ASSOCIATED_MEASURE_GROUP = 'Monthly Sales Forecast'; 
    This version sums up all periods not just the two I've selected:
    Create Member CurrentCube.[Measures].[Actual - Gross Sales PY expt]
    As 
     Sum(EXISTING [Date].[Period Hierarchy].[Yyyy Period].MEMBERS,  
     ( ParallelPeriod( [Date].[Period Hierarchy].[Fin Yr],  
                       1,  
                       [Date].[Period Hierarchy].currentmember  
     ,[Measures].[Actual - Gross Sales])),
    NON_EMPTY_BEHAVIOR = { [Actual - Gross Sales] }, 
    VISIBLE = 1 ,  ASSOCIATED_MEASURE_GROUP = 'Monthly Sales Forecast'; 
    Any help would be much appreciated!

    Hi Walt,
    The “.CurrentMember” function doesn't handle the multiple members, it means the MDX cannot handle a multi-select in Excel. 
    If we are use SSRS report tool which allow us to pass a string into MDX query, it can hanlde multi-select request to get expected data. Here are some related threads about this topic for your reference, please see:
    Sum the same period of this and previous year: http://social.technet.microsoft.com/Forums/en-US/7d9ca803-faf1-4879-a4da-919b77907af8/sum-the-same-period-of-this-and-previous-year?forum=sqlanalysisservices
    SSAS MDX Get Previous Year data for a given date range, and day to day:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/92945862-371a-45d0-a5cb-648b2a4180ab/ssas-mdx-get-previous-year-data-for-a-given-date-range-and-day-to-day?forum=sqlanalysisservices
    Furthermore, I found a article regarding multi select – friendly time calculations in Analysis Services for your reference. Please see:
    http://ditchiecubeblog.wordpress.com/2013/06/16/multi-select-friendly-time-calculations-in-analysis-services/
    Regards,
    Elvis Long
    TechNet Community Support

  • Previous Year Data in Crystal Reports

    Hi Experts,
                      I need to generate crystal report with current year sales data, and previous year sales data.
    How to get previous year sales data in crystal reports (Here am Using BEX Query as a Data source).
    Please do need ful

    Moved to BEX forum

  • Getting the same day of the week from a previous year in a Power Query calc column

    Hi Power Query users,
    Would like to get your suggestions on this problem. I have a customer that wants to see the previous year's sales for the same day of the week. So today is Friday July 25, 2014. Customer would like to see sales for the closest Friday on the previous year,
    which was Friday July 26, 2013. Next year on Friday July 26, 2015, customer would see the sales for Friday July 25, 2014 and so on. Customer operates 7 days a week, all days of the year including holidays.
    What is the most elegant way to do this? I am assuming the best thing to do is to add this date as a calculated column in the date table, but I am not quite sure the best way to write the formula (including handling of edge cases - leap years, providing
    null when the previous year is not part of the date table, etc).
    I am starting with the
    date dimension as presented by Matt Masson.
    Please help if you have any formula suggestions for this.
    Thanks

    Okay, I'm making a couple of assumptions, so please let me know if these assumptions are incorrect:
    1) Instead of all sales data being in a single column, current year and last year sales are provided in different columns,
    2) The previous year sales column shows the sales occurring on the same
    date as the current year sales (so in your example, 43214 is the sales figure for 6/1/2013.
    If the above assumptions are true, we need to modify how the lookup is done. Let's assume that you created a custom column named SameDayOfWeekLastYear. Create another column called Previous Year Date, using the following function (Date_PreviousYear)
    (date) =>
    let   
        PreviousYearDate = Date.AddYears(date,-1),
        PreviousYearDateAdjusted = if (Date.Day(date)=29 and Date.Month(date) = 2) then
                                       #date(9999,1,1)
                                   else PreviousYearDate
    in
        PreviousYearDateAdjusted
    Incidentally, I created this function the week before your query, for a different purpose. In that case, it was to get the previous year sales occurring on the same
    date as the current year sales. It actually gets to your starting point, but with all the sales data in a single column to start with. However, when the current year is a leap year and you apply the Date.AddYears function, February 29th is calculated
    as February 28th of the previous year. If you then do a lookup for previous year sales, you get February 28th sales looked-up twice (the real Feb 28th and the bogus one resulting from taking February 29th back one year). The PreviousYearDateAdjusted identifier
    puts a truly bogus date instead of a duplicated Feb 28th - one that will always return null when looking up the sales value.
    This new date column will then be used to lookup the row of the previous year sales column that corresponds to the dates in the SameDayOfWeekLastYear column.
    Assuming that the last step in your query is InsertedCustom1, create another custom column (Previous Year Net_Same Day?), which returns the sales on the same day as the current year (the result that you're after). The formula would be:
    LookupValue(InsertedCustom1[Previous Year Net], InsertedCustom1[Previous Year Date], [SameDayOfWeekLastYear])
    where LookupValue is the custom function mentioned previously. After creating this new custom column, you can then remove all of the columns you don't need.
    Hope that the preceding is somewhat clear.

  • Pcr To Get The Wage Type Value From Previous Years Master Data Records

    Hi
    I have an issue related to pcr.  I want to get the value of a wage type from previous year and it has to be added to another wage type.  Tried to write pcr by using the operation TABLE.  But i am not able to get the previous years data.  Request to help in writing the PCR for the issue.
    Thanks
    EKP Yadav

    1 - Create an "Information WT" that will be saved into RT but that has no impact on net pay.
    2 - Create a PCR that will be activated on the last pay of the year to read the WT you want and transfer it's information into your Information WT.
    3 - Create a PCR that will read the last payroll results (activated with function PLRT) and transfer into the Input Table (IT) the Information WT.

  • MDX to fetch record from 1st of current month to 5th of next month and same for previous year

    In my date dimension I have a attribute CalendarDate. I do have a hierarchy [Date].[Year].[Quarter].[Month].[CalendarDate] as well. I need to fetch data starting from 1st working day of current month to 5th working day of next month by MDX. I do have a attribute
    to filter working day as IsWorkingDay. How can we get a dynamic MDX that will find the current month first and than it will filter the record from 1st working day of current month to 5th working day of next month. And same for the previous year same month
    to compare.
    Thanks in advance!
    Palash

    Hi P,
    You can use a calculated member to dynamically add all the days in the current month and the first 5 in the following month.  You will need to change measure, cube and hierarchy names.
    with member measures.ThisMonthAnd5 as 
    sum([Date].[Year].parent.children,Measures.[Sales])
    +sum(Head([Date].[Year].parent.nextmember.children,5),Measures.[Sales])
    select 
    {Measures.[Sales]
    ,Measures.ThisMonthAnd5
    } on 0,
    non empty [Date].[Year].[CalendarDate]  
    on 1
    from MyCube
    Richard

  • How to get monthwise opening qty / value for previous years

    I do not get the month wise opening quantity and values for the items for the previous years using the below query. How i can modify this query to get opening qty / value of any year less than current year.
    Yogesh
    SELECT OPN_ITEM_CODE,
    ---------------------------------------OPENING QTY---------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPSTK,3) ELSE NULL END)APR_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPSTK,3) ELSE NULL END)MAY_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPSTK,3) ELSE NULL END)JUN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPSTK,3) ELSE NULL END)JUL_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPSTK,3) ELSE NULL END)AUG_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPSTK,3) ELSE NULL END)SEP_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPSTK,3) ELSE NULL END)OCT_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPSTK,3) ELSE NULL END)NOV_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPSTK,3) ELSE NULL END)DEC_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPSTK,3) ELSE NULL END)JAN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPSTK,3) ELSE NULL END)FEB_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPSTK,3) ELSE NULL END)MAR_OPQ,
    ---------------------------------------OPENING VALUE----------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPVAL,3) ELSE NULL END)APR_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPVAL,3) ELSE NULL END)MAY_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPVAL,3) ELSE NULL END)JUN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPVAL,3) ELSE NULL END)JUL_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPVAL,3) ELSE NULL END)AUG_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPVAL,3) ELSE NULL END)SEP_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPVAL,3) ELSE NULL END)OCT_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPVAL,3) ELSE NULL END)NOV_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPVAL,3) ELSE NULL END)DEC_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPVAL,3) ELSE NULL END)JAN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPVAL,3) ELSE NULL END)FEB_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPVAL,3) ELSE NULL END)MAR_OPV
    FROM( SELECT SL_ITEM_CODE OPN_ITEM_CODE, SL_DT,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_QTY_BU/IU_CONV_FACTOR/IU_MAX_LOOSE_1)OPSTK,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_VAL_1)OPVAL
    FROM OS_STK_LEDGER, OM_ITEM_UOM
    WHERE SL_ITEM_CODE = IU_ITEM_CODE
    GROUP BY SL_ITEM_CODE, SL_DT
    GROUP BY OPN_ITEM_CODE

    it think you need to look for [lag and lead|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#sthref1753]

  • I use since 1 year iTunes match. Do I get a mail from apple to renew my subscription or do I have to renew my subscription for my own? I don't know the exactly date from the end of lifetime?

    I use since 1 year iTunes match. Do I get a mail from apple to renew my subscription or do I have to renew my subscription for my own? I don't know the exactly date from the end of lifetime?
    Kind best regards - sunshine34778

    The subscription will renew automatically (unless you have disabled that) and you will get an email approximately one month before renewal.

  • Catch up depreciation from previous year

    Hi all,
    I am using an asset from 1st July 2008. But we have posted the first APC in month of March 2009 using transaction (CJ88) with Asset value date as 1st Feb 2009. As a result the capitalisation date in Asset master shows 1st Feb 2009.
    (APC amount 3337.15, Straight line dep for 10 yrs).
    (Note: I have mentioned 1st Nov 2008 as ordinary dep start date against Ordinary depreciation area).
    Now when depreciation is run for March 2009, I could see catch up depreciation for month February and March depreciation i.e., (27.8+27.8) = 55.16
    But I need to post in March 2009, catch up for 8 months (july 08 to feb 09) and march month's dep.
    When i tried to change Asset value date to 1st July 08 for other assets while posting CJ88, system doesnot allow me as its in previous year 2008. It permits me to enter saome date in 2009 only.
    Currently I am using unplanned ordinary dep.
    Could anyone please help me by suggesting any method so that I need not run ordinary depreciation everytime and decrease my workload.
    Thanks,
    DSK

    Hi,
    prior year depreciation is not automatically caught up by the depreciation run. If you need to catch up prior year values, then indeed you have to post unplanned depreciation.
    Of course it would be best to capitalize the asset at the moment of readiness and not to wait a couple of months.
    Regards,
    Markus

  • HT201269 I have years worth of music on my PC that is about to die.  If I get an iPad is there anyway to get the music from my PC onto the iPad? I have the iCloud but my understanding is only music actually purchased from iTunes lives int he cloud.

    I have years worth of music on my PC that is about to die.  If I get an iPad is there anyway to get the music from my PC onto the iPad? I have the iCloud but my understanding is only music actually purchased from iTunes lives int he cloud. I have music that was legally purchased and loaded to my iTunes account from cd's that I no longer own.  I need a new laptop and am deciding between the iPad and the Mac book.  I use the computer for music, photos, and web - nothing else and nothing fancy.  I don't know that there is a way to save my huge music library without saving it to an external hard drive and then loading it to a new one (does the iPad have a port to plug an external hard drive into?)

    First, you would need to make a backup of the entire iTunes folder on the PC. You could get music to the iPad if the PC was still functioning, or you would have to move the music to another computer. An iPad is not a laptop, and does not have a port to plug an external drive into. You can sync music to the iPad from the computer, but you are correct, unless you get iTunes Match, you would need a computer to copy the music to and then sync to an iPad.

  • I have subscribed to itunes match. How do I get the songs from my iphone into my itunes library which only shows the songs I have purchased? Lots of the songs on my iphone were taken from CD's years ago which is why I thought itunes match would help.

    I have subscribed to itunes match. How do I get the songs from my iphone 5 into my itunes library which  currrently only shows the songs I have purchased? I can see the songs on my iphone when I plug it into itunes on my computer, but don' know how to get them into the library.Lots of the songs on my iphone were taken from CD's years ago which is why I thought itunes match would help.I want to make the songs on my phone's itunes available to my husbands iphone and to my ipad as well.  All devices share the same itunes account.

    Hi,
    Read this user tip Recover your iTunes library from your iPod or iOS device
    Does it help?
    Jim

  • Capturing "Actual Amounts" from previous years

    Hi Experts,
    We had earlier developed a report to produce a list of projects which can be changed from status TECO to CLSD. If the project cannot be closed then the corresponding reason for failure should be displayed.
    Now the problem is that there were some direct costs which were booked under certain WBS elements. These elements were created in the previous year & haven't been settled in that year. Our present program isn't able to capture & display these costs in the current year. We have based our logic up on a join of table COBK with tables COEP, PROJ & PRPS. We are referring to the SAP standard TCODE s_alr_87013533 which is able to find the unsettled dollars (Actual amount) even from previous years. Anyone please help advise as to how we can even capture the actual amounts from previous years.
    Regards,
    Uday
    Our inner join statement is as shown below:
    SELECT coep~objnr coep~wogbtr coep~megbtr coep~wrttp coep~kstar
             coep~owaer coep~vrgng coep~sgtxt coep~ebeln coep~ebelp
             coep~objnr_n1 coep~belnr coep~gjahr coep~perio
             cobk~blart cobk~refbn cobk~refbk cobk~refgj
        INTO CORRESPONDING FIELDS OF TABLE tb_actual
        FROM coep INNER JOIN cobk ON cobk~kokrs = coep~kokrs AND
                                     cobk~belnr = coep~belnr
                  INNER JOIN prps ON coep~objnr = prps~objnr
                  INNER JOIN proj ON proj~pspnr = prps~psphi
        WHERE proj~pspnr  = wa_proj-pspnr   "project definition
          AND prps~pspnr  = wa_prps-pspnr   "WBS element
      AND prps~belkz =  c_x             "Account assignment
      AND coep~wogbtr <> 0              "amount
      AND coep~lednr = c_00             "Ledger (needed to hit index)
      AND coep~wrttp IN (c_04, c_11)    "actual value type - real & stat
      AND coep~beknz IN r_beknz.        "D/C Ind <> Settlement

    based on the data provided -
    I-001688               
    Cost line                       7143.28          71710000
    Cost line                     42874.74          73120000
    Cost line                     22752.77          73120000
    TOTAL COST     72770.79          
    Settlement line     65627.51          81650000
    Settlement line     7143.28          81650000
    TOTAL SETL     72770.79          
    you should be able to set CLSD to this project as there is no unsettled value in the project
    CJI3 report confirms that there is no outstanding settlement and hence project can be set to CLSD. This report shows all the line items against project
    The report S_ALR_87013533 shows the actual cost incurred in the project, but not settlement. This does not mean that the project is unsettled.
    see another report (project cost element report) - that might help you S_ALR_87013542

Maybe you are looking for