Ago and To Date Functions together

Hi here is my requirement, i wanted to create a column which captures previous year's Period to date.
Period To Date gives value from 1st of this Period to today's date for present year 2012, but i want to capture the values from starting date of Period to today's date but for previous year 2011.
If for example : Period 1 of 2012, prior period would be Period 1 of 2011
I am assuming this logic will work,
First i will capture Period To Date by using (To date function), and then use AGO function where Time Offset = Period and Number of Periods = 12.
Please find the below function i used.
Ago( ToDate("Core"."Fact - Sales - Invoice Line"."Net Invoiced Amount" , "Core"."Date"."Enterprise Period" ), "Core"."Date"."Enterprise Period" , 12) .
But i found few inconsistency in the data, so kindly please help me in this.

Try this.
Instead of using 2 time series functions in one columns create separate columns
ex:
1. Create Prior YTD as :ToDate("Core"."Fact - Sales - Invoice Line"."Net Invoiced Amount" , "Core"."Date"."Enterprise Period" )
2. Now create Ago column as : Ago (Prior YTD, "Core"."Date"."Enterprise Period" , 12)
HTH

Similar Messages

  • Problems with driver 10.020 and returning data piped together for reports

    Hi,
    We have recently upgraded our UAT database to Oracle 10g and i have been trying to test reports that we have running against the database. I have come across a problem when piping ("||") together columns to return a single column e.g.
    SELECT filed1||','||field2||','||field3 FROM Dual
    It seems that if a certain number of columns is returned it will return the data with each character separated with a CHR(0). Does anyone know why this is happening as it doubles the size of reports as the is double the amount of characters!!
    The only way i have managed to sort of fix it is to return smaller concatinated blocks, is there a limit on piping fields or different datatypes together?
    Thanks
    PM

    Here is one of our report SQL statements. I have added a carriage return where i have added a comma to create a new column.
    select ' Date,Centre,Division,Time_Taken,',
    'Putaways,Case_Putaway,Replens,Case_Replens,Total Orders,R20_Pallets_Picked,R20_Case_Picked,',
    'R20_Total_Pallets,R30_Case_Picked,R30_Lines_Picked,R30_Pallets_Picked'
    from dual
    union
    select inv.dstamp||','||inv.centre||','||inv.colour||','||
    decode(length(to_char(floor(sum(elapsed_time)/60/60))),1,'0','')||floor(sum(elapsed_time)/60/60)||':'||
    decode(length(to_char(mod(floor(sum(elapsed_time)/60),60))),1,'0','')||mod(floor(sum(elapsed_time)/60),60)||':'||decode(length(to_char(mod(sum(elapsed_time),60))),1,'0','')||mod(sum(elapsed_time),60)||',',
    count(decode(inv.code,'Putaway',inv.tag_id))||','||
    round(nvl(sum(decode(inv.code,'Putaway',cases)),0))||','||
    count(decode(inv.code,'Replenish',inv.tag_id))||','||
    round(nvl(sum(decode(inv.code,'Replenish',cases)),0))||','||
    count(distinct decode(inv.code,'Pick',inv.reference_id))||','||
    count(decode(inv.code||substr(loc.work_zone,1,3),'PickR20',inv.tag_id))||',',
    round(nvl(sum(decode(inv.code||substr(loc.work_zone,1,3),'PickR20',cases)),0))||','||
    count(decode(substr(loc.work_zone,1,3),'R20',inv.tag_id))||','||
    round(nvl(sum(decode(inv.code||substr(loc.work_zone,1,3),'PickR30',cases)),0))||','||
    count(distinct decode(inv.code||substr(loc.work_zone,1,3),'PickR30',
    inv.reference_id||inv.line_id))||','||
    count(distinct decode(inv.code||substr(loc.work_zone,1,3),'PickR30',inv.pallet_id))
    from
    (select 'RETAIL' as centre, 'BABY' as colour
    from dual
    union select 'RETAIL' as centre, 'MEDICAL' as colour
    from dual
    union select 'HOMEWARD' as centre, 'BABY' as colour
    from dual
    union select 'HOMEWARD' as centre, 'MEDICAL' as colour
    from dual
    union select 'RETAIL' as centre, 'UNKNOWN' as colour
    from dual
    union select 'HOMEWARD' as centre, 'UNKNOWN' as colour
    from dual) cd,
    (select
    TO_CHAR(inv.dstamp, 'YYYY-MM-DD') AS dstamp,
    DECODE(OH.User_Def_Type_1, '20', 'HOMEWARD',
                   DECODE(OH.User_Def_Type_1, '22', 'HOMEWARD',
                   DECODE(OH.User_Def_Type_1, '23', 'HOMEWARD',
                   DECODE(OH.User_Def_Type_1, '24', 'HOMEWARD', 'RETAIL')))) AS Centre,
    NVL(s.colour, 'UNKNOWN') AS colour,
    inv.user_id, inv.elapsed_time, inv.code,
    inv.tag_id,
    decode(inv.code,'Replenish',inv.from_loc_id, 'Pick',inv.from_loc_id,
    'Putaway',inv.to_loc_id) as LOCATION_ID,
    decode(inv.update_qty,0,1,inv.update_qty)/pac.ratio_1_to_2 as cases,
    inv.reference_id, inv.line_id, inv.pallet_id
    from
    inventory_transaction inv, order_header oh, sku s, sku_config pac
    where
    inv.client_id = oh.client_id (+)
    and inv.reference_id = oh.order_id (+)
    and inv.site_id = oh.from_site_id (+)
    and inv.client_id = s.client_id
    and inv.sku_id = s.sku_id
    and inv.config_id = pac.config_id
    and inv.code in ('Replenish','Pick','Putaway')
    and inv.dstamp BETWEEN TO_TIMESTAMP(TO_CHAR(NEXT_DAY(SYSDATE,'MONDAY')-interval '14' day,'DD/MM/YYYY')||' 00:00:00','DD/MM/YYYY HH24:MI:SS.FF')
    AND TO_TIMESTAMP(TO_CHAR(NEXT_DAY(SYSDATE,'SUNDAY')-interval '7' day,'DD/MM/YYYY')||' 23:59:59','DD/MM/YYYY HH24:MI:SS.FF')
    and inv.client_id = 'NUTRICIA'
    and inv.site_id = 'WAR01') inv,
    location loc
    where cd.centre = inv.centre (+)
    and cd.colour = inv.colour (+)
    and inv.location_id = loc.location_id
    and loc.site_id = 'WAR01'
    and (loc.work_zone like 'R20%' or loc.work_zone like 'R30%')
    group by
    inv.dstamp, inv.centre, inv.colour

  • Date Function Error

    Hello,
    I am trying to calculate Goods movement date and used DATE Function "Between" to find out the dates between BUDAT and Current Date/System Date(used date function NOW().
    between(BUDAT,AGEING_DATE)
    Validate syntax doesn't show any error, however while activating view I am getting below error:
    Message :
    Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Analytic View (CV): nnAttribute 'aging_day' is missing in node finalAggregation(CalculationNode (finalAggregation) -> attributes -> calculatedAttribute (GOODS_MOVEMENT_DATE) -> expression)nnThe following errors occured: Inconsistent calculation model (34011)nDetails (Errors):n- CalculationNode (finalAggregation) -> attributes -> calculatedAttribute (GOODS_MOVEMENT_DATE) -> expression: Attribute 'aging_day' is missing in node finalAggregation.n- CalculationNode (finalAggregation) -> attributes -> calculatedAttribute (GOODS_MOVEMENT_DATE) -> expression: Attribute 'budat' is missing in node finalAggregation.nnDetails (Warnings):n- cubeSchema: Default language not set. Use 'en'.nnnn<?xml version="1.0" encoding="utf-8"?><cubeSchema version="3" operation="createCalculationScenario"><calculationScenario name="Inventory_Aging/AV_INVENTORY_AGING_PER_SITE" schema="_SYS_BIC"><dataSources><olapDataSource name="dataSource" schema="_SYS_BIC"
    Any inputs are highly appreciable.
    BR
    Vijaya

    Hi @Vijaya Lakshmi,
    Could you please check this part of the error message in detail:
    Error:Deploy Analytic View (CV): nnAttribute 'aging_day' is missing in node finalAggregation(CalculationNode (finalAggregation
    BR
    Prabhith

  • Bad performance due to the use of AGO and TO_DATE time series functions

    Hi all,
    I'm building an OBI EE Project on top of a 1TB DW, and i'm facing major performance problems due to the use of the AGO and TO_DATE time series functions in some of the Metrics included on the reports. I discovered that when a report with one of those metrics is submited to the DB, the resulting query/explain plan is just awful!... Apparently OBI EE is asking the DB to send everything it needs to do the calculations itself. The CPU cost goes to the roof!
    I've tried new indexes, updated statistics, MV's, but the result remains the same, i.e., if you happen to use AGO or TO_DATE in the report you'll get lousy query time...
    Please advise, if you have come across the same problem.
    Thanks in advance.

    Nico,
    Combining the solution to view the data in dense form (http://gerardnico.com/wiki/dat/obiee/bi_server/design/obiee_densification_design_preservation_dimension), and the use of the lag function (http://gerardnico.com/wiki/dat/obiee/presentation_service/obiee_period_to_period_lag_lead_function) appears to be the best solution for us.
    Thanks very much.

  • Generic "AGO" and "TODATE" functions

    Hi, I'd like to find out if it's possible to have "generic" date functionality that applies at whatever date level the user chooses. For example, instead of having:
    Day Sales
    Prior Day Sales
    Year Ago Day Sales
    Week Sales
    Prior Week Sales
    Year Ago Week Sales
    Month Sales
    Prior Month Sales
    Year Ago Month Sales
    Quarter Sales
    Prior Quarter Sales
    Year Ago Quarter Sales
    Year Sales
    Prior Year Sales
    instead I'd like to have:
    Sales
    Prior Period Sales
    Year Ago Period Sales
    It looks like the "AGO" function, for instance, requires the time level to be put in. But I'd rather NOT put a specific time level in - and have that default to whatever the user asks for in the report. i.e. if they put "Jan 2009" in the report then it knows it's at the month level. If they put "Q3 2009" in it would know to do it at the quarter level, etc.
    Is there any way to do this?
    Thanks in advance,
    Scott

    To reply to my own question. It appears I got it working, that is, the error message problem is solved, but I still have questions on how to use these functions.
    To get it to work, I added the primary key D_TIJD.TIJDKEY at the level of the lowest grain in my dimension (level tab).
    What I still wonder is how to make it select the right values. I have the following hierarchy: bookyear - bookperiod - week. A bookperiod contains 4 or 5 weeks (4,4,5 in a quarter), so 12 periods in one year. I defined a measure at period level and another at that level with the ago function, that should return the figures for that same period of the year before. My first question is, whether to go back 12 periods or 52 weeks (which is the lowest grain in my dimension)?
    The second question is how to use a combination of TODATE and AGO so that if I calculate the current period (of which only 2 weeks are passed), I also only want to include the same two weeks for that period one year ago in order to make a correct comparison. How do I do that???

  • AGO and TODATE functions

    I want to use the AGO and TODATE functions to calculate a measure for the selected year and the year before, as well as a year--o date measure, but cannot get it to work. It fails with the following error:
    A general error has occurred. [nQSError: 22040] To use TODATE function, the storage level of the query ('[D_TIJD.TIJDKEY]') must be a static level.
    I have setup a time dimensions in which I can drill up and down and followed exactly the same steps that were layed out in the Oracle training activity guide, but so far without any luck. From Mark Rittman's articles I learned that using these functions is not as straight forward as one might hink. Does anybody have a working example of this?
    Regards,
    Paul

    To reply to my own question. It appears I got it working, that is, the error message problem is solved, but I still have questions on how to use these functions.
    To get it to work, I added the primary key D_TIJD.TIJDKEY at the level of the lowest grain in my dimension (level tab).
    What I still wonder is how to make it select the right values. I have the following hierarchy: bookyear - bookperiod - week. A bookperiod contains 4 or 5 weeks (4,4,5 in a quarter), so 12 periods in one year. I defined a measure at period level and another at that level with the ago function, that should return the figures for that same period of the year before. My first question is, whether to go back 12 periods or 52 weeks (which is the lowest grain in my dimension)?
    The second question is how to use a combination of TODATE and AGO so that if I calculate the current period (of which only 2 weeks are passed), I also only want to include the same two weeks for that period one year ago in order to make a correct comparison. How do I do that???

  • Nested Ago and Todate function problem

    Hi,
    in my rpd i have following Time hierarchy:
    Year
    Quarter
    Month
    and a fact table Fact Shop which contains Monthly measure "Number of Hearing Aids Delivered".
    I must calculate PY_QTD, PY_YTD versions of above measure.
    I have tried to use built-in Time Functions Ago and ToDate in the following way:
    PY_QTD
    Todate(Ago("Number of Hearing Aids Delivered",1,"Time.Year"), "Time.Quarter")
    PY_YTD
    Todate(Ago("Number of Hearing Aids Delivered",1,"Time.Year"), "Time.Year")
    but when i check consistency i have error which says approximately "You can nest Ago and ToDate functions".
    There's another way, to calculate it? Can you help?
    Thanks
    Giancarlo

    So u r referring PY as previous year ;)
    Here u go;
    it’s a combination of AGO and TODATE.
    You create a value – let’s say Sales MTD by just following normal process…then you create a logical column with the following formula AGO (Sales MTD, Month Dim, 12)
    that should give you a MTD measure you’re looking for. I hope this is useful. Just dont use both function in single logical column....use seperate by first creating YTD n then AGO function to create previous year data.
    For ur case use to calculate PY_YTD use below:
    Create logical column
    Aids Delivered YTD with formula as TODATE("Number of Hearing Aids Delivered"), "Time.Year")
    and then create another logical column as
    Aids Delivered PY_YTD with formula as AGO("Aids Delivered YTD","Time.Year",1)
    This will work for sure....

  • I can't make or take phone calls, but i can message and use data. Has this happened to anyone else? I've gone through three Samsung Galaxy S5's in the past three days, two of which have this problem and one just stopped working all together.

    My phone doesn't have any cellular phone functions...but it CAN send text messages and access data. Has this happened to anyone else? I've gone through three Samsung Galaxy S5's in the past three days, the last two have this problem and the first stopped working all together. I've had new sim cards put in, ive done hard resets on the phone, i've rebooted the phone, done battery pulls, and tech support has reset the signal to my phone. Nothing has worked. (I just "upgraded" <- lol.... and my old phone IS turned off.)

    Im in 79707. So to recap my whole case: I upgraded my device using the verizon wireless website. I received my phone and switched my old SIM card from my Droid Razr Maxx HD into the new Galaxy S5. Everything worked fine until the next morning (May 31st) when I woke up and the phone wouldn't turn on. I took the phone to the local Verizon store and they were also unable to turn it on. They issued me a new Galaxy S5 (referred to as phone 2) and switched my SIM card into that one.
    With PHONE 2 i was able to make calls and receive calls, along with text and data for approximately four hours. After that, i was unable to use the phone function of the device, but text and data were still functioning. I took PHONE 2 back to the Verizon store where they attempted to hard reset the phone twice, they also installed two new SIM cards at the store. After this they would get the same error, which is the phone just reading "Dialing..." after attempting to make a call. The Verizon associate declared the phone "DOA" and issued me another Galaxy S5 (referred to as PHONE 3).
    PHONE 3 worked well, with phone text and data featured intact from when I received it on the after noon of the 31st until approximately 2:30PM on June 1st. I contacted Verizon Tech Support via Gmail phone to attempt the correct the problem. They reset the connection, had me do a battery pull, had me close the "phone" application, and erase the data and catche, then restart the phone. All of which had no effect. My phone is still able to receive texts and use data (even with wifi off) it simply cannot make or take phone calls. all it says is "dialing..." when I attempt to make a call. When other phones call my device it rings once on their end and directs them to voicemail, PHONE 3 does not ring on my end.
    I have made sure my old phone is completely powered down.

  • Ago and Todate functions very slow

    I have been playing around with the Ago and Todate functions in BI EE (based on data from the Global schema which I imported into BI EE Administrator) but I find these functions very slow to return the data in an Answers report. Has anyone else found this?

    What's the size of the data set?
    Yes, I'm currently experiencing it. Running on a 600-700k rows tables...
    However, there're 2 things that might help:
    a) we're doing development with cache off - enabling cache - makes report come instantly...
    b) make sure the metrics have correct levels set up - i.e. it's sometimes advantageous to have several duplicates of 1 metric just for this purpose...with different levels....
    Please let me know if you find other ways to improve performance...

  • Function to get differenece between sy-datum and any date entered in days

    Dear Friends;
                    I have to find out the days difference between sy-datum and any valid date that come from table . Is there any function available in SAP that will give me
    the difference in  no. of  days between sy-datum and any date that come from table??
                   please help me out.
    Regards;
    Parag

    Just subtract the dates from each other and you will get the number of days. I have used it and it works prefect
    try this:
    DATA: date1 like sy-datum,
    date2 like sy-datum.
    data I type i.
    date1 = '20070301'.
    date2 = '20070228'.
    i = date1 - date2.
    write: / date1, date2, i.
    date1 = sy-datum.
    date2 = sy-datum - 30.
    i = date1 - date2.
    write: / date1, date2, i.
    SD_DATETIME_DIFFERENCE

  • Creation and Change Date for Tcode and Function Groups

    Hello All,
    I need to display the Creation and Change Dates for Custom Tcodes and Function Groups in a Report. Can anyone please let me know the logic of retrieving it.
    regards,
    Mahesh

    Hi,
    TADIR and TRDIR is the tables where you can find all these data
    Regards
    Sudheer

  • In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?

    In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?
    =IF(I127,NOW()," ")
    I127 equals a check box. The formula retuns a value of the current date and time when a check is placed in the box. How does one lock that date and time so that it cannot be changed?

    I don't think it is possible to lock in the date and time using a formula. You could put NOW() in a cell, copy, and Edit Paste Formula Results where you want the result.
    Or if you are "time stamping" a lot, you may find this Automator Service (Dropbox download) helpful. It puts a "Today" function (actually it should be named "Now" because it includes both date and time) in your Services menu like this:
    Just doubleclick the .workflow package to install it. You may have to click "download anyway" in System Preferences > Privacy & Security.
    If you want you can assign the service a keyboard shortcut in System Preferences here:
    SG

  • I can't open a file I just created a week ago and it says pages needs to be updated to open the file but its up to date

    I can't open a file I just created a week ago and it says pages needs to be updated to open the file but its up to date, what do I do?

    You have 2 versions of Pages on your Mac.
    Pages 5.2.2 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed over 110 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    You can add the icon of the missing Pages on your Dock or open Pages from the Apple menu > Recent Items list.
    Or you can archive Pages 5 so that it doesn't automatically open.
    If you are unhappy about this review/rate Pages 5 in the App Store.
    Peter

  • Function module to find start date and end date of fiscal year for company

    Hi,
    Is there any function module exist which will provide me start date and end date of fiscal year for company code and fiscal year provided?
    Thanks & Regards,
    Parag

    Hi,
    please check this link
    it would be very useful
    http://www.sapdevelopment.co.uk/fmodules/fms_fiscalyr.htm
    Thanks and regards
    durga.K

  • Function Module to get PO details based on Plant and PO date

    Hi
    1. Is there any Function Module to get PO details based on Plant and PO date?
    2. Is there any Function Module to get Material document details based on PO number?
    Thanks
    Narendra

    hi,
    check these standard reports.
    ME2L - By vendor
    ME2M - By material
    MSRV3 - By service
    ME2K - By account assignment
    ME2C - By material group
    ME2B - By tracking number
    ME2N - By PO number
    ME2W - By supplying plant
    also chck this func module.
    REPL_LIST_PURCHASE_ORDER_READ
    reward if hlpful.

Maybe you are looking for

  • Moving files from windows to mac

    Hi All, Some time soon my son is going to buy a Mac Pro or if they come out w/ a new model I will buy a new one and give him this one which is not too old. He now uses a windows XP pc. the question I have is how do I / he transfer his files from the

  • .itl file is locked error after installing new build - iTunes won't open

    After upgrading to the new build itunes won't open. I receive an error message "The iTunes Library .itl file is locked, on a locked disk, or you do not have write permission for this file." When I check permissions I have full control. I tried uninst

  • Finding a logical name for PXI5112 modules to be used in niScope_Init

    I need to dynamically allocate the number of PXI5112 modules on several PCs in a C++ program. After going through great length using VISA calls to obtain the VISA logical name ( PXI3::11::INSTR, etc.), I found out that niScope_Init is expecting an IV

  • Not a valid AIRI or AIR file

    Trying this: adt -package -keystore HelloWorld.p12 -storetype pkcs12 -target bundle HelloWorld.app HelloWorld.xml Gives me the error: File /Users/cameron/HelloWorld/HelloWorld.xml is not a valid AIRI or AIR file And here is the contents of that XML f

  • Music in Safari

    I've recently put up a web-site and my music pops when I listen to it in Safari, but it doesn't in Firefox or IE. Does anyone know what's causing this?