Year to date question!

Hi Experts -
I need a report like below:
Employee         Aug Sales       YTD Sales
Jon                      5000                 60000
Tom                     2000                 70000
I was reading through the forum and I see that I have to use customer exit for that. I'm using 0CALMONTH for my variable.
But I also saw that I can avoid the customer exit and use the properties on the key figure.
But the figures are not correct.
I read here that in the properties Calculations -> Calculate as Single Value-> choose Standard Value. But I don't have any option for 'Standard Value' .
Can someone please share his/her thoughts on this? Thanks a lot!

Hi Gill -
Thanks for the response.
I have created a variable on 0CALMONTH and using it for user input. The var name is ZTEMP .
I have created another variable on 0CALMONTH with a customer exit and the name is 'ZU_YR_TO_DATE'.
Now I have the following code...can someone one please take a look at it and modify it so I can get a range of beg month to user month. As an example, if the user chooses Aug 2007, the range should be Jan 2007 - Aug 2007.
DATA: L_S_RANGE TYPE RSR_S_RANGESID.
DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
Data: v_loc_date type d.
Data: v_loc_date1 type d.
Data: v_loc(4) type c.
CASE I_VNAM.
WHEN 'ZU_YR_TO_DATE'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZTEMP'.
CLEAR L_S_RANGE.
v_loc_date1 = LOC_VAR_RANGE-LOW.
v_loc_date = LOC_VAR_RANGE-LOW(4). "low value, e.g.200001
v_loc_date+4(4) = '0101'.
L_S_RANGE-LOW = v_loc_date1 - v_loc_date. "get the difference between current date & first date of year
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
ENDCASE.

Similar Messages

  • Are Cube organized materialized view with Year to Date calculated measure eligible for Query Rewrite

    Hi,
    Will appreciate if someone can help me with a question regarding Cube organized MV (OLAP).
    Does cube organized materialized view with calculated measures based on time series  Year to date, inception to date  eg.
    SUM(FCT_POSITION.BASE_REALIZED_PNL) OVER (HIERARCHY DIM_CALENDAR.CALENDAR BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT DIMENSION LEVEL DIM_CALENDAR."YEAR")
    are eligible for query rewrites or these are considered advanced for query rewrite purposes.
    I was hoping to find an example with YTD window function on physical fact dim tables  with optimizer rewriting it to Cube Org. MV but not much success.
    Thanks in advance

    I dont think this is possible.
    (My own reasoning)
    Part of the reason query rewrite works for base measures only (not calc measures in olap like ytd would be) is due to the fact that the data is staged in olap but its lineage is understandable via the olap cube mappings. That dependency/source identification is lost when we build calculated measures in olap and i think its almost impossible for optimizer to understand the finer points relating to an olap calculation defined via olap calculation (olap dml or olap expression) and also match it with the equivalent calculation using relational sql expression. The difficulty may be because both the olap ytd as well as relational ytd defined via sum() over (partition by ... order by ...) have many non-standard variations of the same calculation/definition. E.g: You can choose to use or choose not to use the option relating to IGNORE NULLs within the sql analytic function. OLAP defn may use NASKIP or NASKIP2.
    I tried to search for query rewrite solutions for Inventory stock based calculations (aggregation along time=last value along time) and see if olap cube with cube aggregation option set to "Last non-na hierarchical value" works as an alternative to relational calculation. My experience has been that its not possible. You can do it relationally or you can do it via olap but your application needs to be aware of each and make the appropriate backend sql/call. In such cases, you cannot make olap (aw/cubes/dimensions) appear magically behind the scenes to fulfill the query execution while appearing to work relationally.
    HTH
    Shankar

  • How to calculate Prior Year To Date in SSRS

    Hi,
    I've been developing reports in Crystal for a while. The new ERP software we have just purchased uses SSRS for all of their reports. I just started converting the crystal reports to SSRS. I can't seem to find an easy way to do a calculation for Prior Year
    to Date or Prior Year Month to Date in SSRS. Can somebody help me?
    Thanks,
    Cindy

    Your best bet would be to use a calendar table in the TSQL queries. I wrote an article on them here: http://social.technet.microsoft.com/wiki/contents/articles/29260.tsql-calendar-functions-and-tables.aspx
    Alternatively you can use a formula like:
    =DateValue(DATEADD(DateInterval.Day,1-DATEPART(DateInterval.DayOfYear,NOW()),Now()))
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • GROUP BY GROUPING SETS for a selected month and for year to date

    Below is a code example to demonstrate this question:
    declare @test table (ID int, Quantity int, Day date);
    insert into @test values
    (4, 500, '1/18/2014'),
    (4, 550, '1/28/2014'),
    (7, 600, '1/10/2014'),
    (7, 750, '1/11/2014'),
    (7, 800, '1/20/2014'),
    (1, 100, '1/2/2014'),
    (1, 125, '1/10/2014'),
    (8, 300, '1/7/2014'),
    (9, 200, '1/17/2014'),
    (9, 100, '1/22/2014'),
    (4, 900, '2/18/2014'),
    (4, 550, '2/28/2014'),
    (7, 600, '2/10/2014'),
    (7, 700, '2/11/2014'),
    (7, 800, '2/20/2014'),
    (1, 100, '2/2/2014'),
    (1, 150, '2/10/2014'),
    (8, 300, '2/7/2014'),
    (9, 200, '2/17/2014'),
    (9, 100, '2/22/2014'),
    (4, 500, '3/18/2014'),
    (4, 550, '3/28/2014'),
    (7, 600, '3/10/2014'),
    (7, 750, '3/11/2014'),
    (7, 800, '3/20/2014'),
    (1, 100, '3/2/2014'),
    (1, 325, '3/10/2014'),
    (8, 300, '3/7/2014'),
    (9, 200, '3/17/2014'),
    (9, 100, '3/22/2014'),
    (4, 500, '4/18/2014'),
    (4, 550, '4/28/2014'),
    (7, 100, '4/10/2014'),
    (7, 750, '4/11/2014'),
    (7, 800, '4/20/2014'),
    (1, 100, '4/2/2014'),
    (1, 325, '4/10/2014'),
    (8, 300, '4/7/2014'),
    (9, 200, '4/17/2014'),
    (9, 100, '4/22/2014'),
    (4, 500, '5/18/2014'),
    (4, 550, '5/28/2014'),
    (7, 600, '5/10/2014'),
    (7, 750, '5/11/2014'),
    (7, 50, '5/20/2014'),
    (1, 100, '5/2/2014'),
    (1, 325, '5/10/2014'),
    (8, 300, '5/7/2014'),
    (9, 200, '5/17/2014'),
    (9, 100, '5/22/2014');
    --detail
    select *
    from @test;
    --aggregation
    select
    TotalQuantity = sum(Quantity),
    [Month] = month(Day)
    from @test
    group by
    grouping sets
    (month(Day)),
    (year(Day))
    go
    This is the aggregation query result:
    However, the desired result is to return only two rows: one row for month 3 and the other row for year to date (in the picture above YTD is the row that appears with {null} in the Month column).  Is there a way to achieve this goal by modifying the
    sample code above?  The requirement is to only read the data once (do not want a solution that involves a UNION which implies reading the data twice).

    you can add required filters in having clause. Here is the query -
    select
    TotalQuantity = sum(Quantity),
    [Month] = month(Day)
    from @test
    group by
    grouping sets
    (month(Day)),
    (year(Day))
    having
    month(Day) = 3 or month(Day) is null;

  • FCX - Routing Guide and Year to date quantity

    Hello all.
    I need some help to understand the Routing Guide within SAP FCX add on. We are using this add on for quite some time.
    Question I have: How does the routing guide calculates the Year to date Quantity ?
    This filed is part of each routing guide records ( /SAPRGX/KOND2-YTD_QTY ).
    I have some evidence that the counter isn't working correctly. Therefore I would like to understand the logic behind the calculation.
    Thanks in advance.
    Joerg

    Got the answer via OSS note I created.
    Thanks

  • About year(), month(), date(), hour(), minute(), second() in Oracle

    In DB2, I can get the value of year, month, date, hour, minute, second from current timestamp by year(), month(), date(), hour(), minute(), second(). Like below SQL,
    SELECT current timestamp, year(current timestamp), month(current timestamp), date(current timestamp), hour(current timestamp), minute(current timestamp), second(current timestamp) FROM DUAL
    In Oracle, how can I modify above SQL?
    That is, do we have the corresponding function to each one of them in DB2?
    Thanks,
    JJ

    Hi Turloch,
    Thanks for your help.
    Here, I have another question.
    How about the days caculation?
    For example, in DB2, I have a SQL as below,
    select
    account_no
    from
    lit_transaction
    where
    ( start_date + no_of_days days - exp_days days) <= CURRENT DATE
    How can I modify above days caculation for Oracle?
    Thanks,
    J.

  • Last year to date

    afternoon all,
    I am so confuse with these year to date dates, what is the best practice if you want to get all the dates from last year upto today's date.
    For example, Today is 16/01/2009, so effectively the last year to date would be 16/01/2008 to 16/01/2009.
    I am thinking of using =Today-365
    or  =Currentdate-365
    or  =(dateserial('y',-1,)
    Perhaps you can give me some ideas?
    Regards
    Jehanzeb

    I forgot to ask another question. I am using the following formula under my Record Selection formula,
    Does this formula means from Last year to date?
    ({lab_rework.rework_date} in date(year(currentdate),1,1) to
    dateserial(year(currentdate), month(currentdate)+1,1)-1
    Sorry but I am so confused with these date formulas.
    The purpose is to get last year to date records, that is 16/01/2008 to 16/01/2009 where 16 is currentdate.
    Regards
    Jehanzeb

  • Rip of year from date field

    I have a question. I want to rip of the year from date field. For e.g if date is 01/02/2006 I want just the 01/02 which month and date. I tried to use substr function but it;s giving weird result. I used substr(date, 0,5) but not working. Please suggest.

    If it is a DATE column/variable it is conventional to use TO_CHAR with an appropriate date format, in your case TO_CHAR (date_column, 'MM/YY').

  • SSRS expression for today,yesterday,Lastweek ,Last fortnight,Last Month, Year to date

    Hi All;
    I have a field called createdon 
    Using this field i need to create the SSRS expression for the table as below 
    Any help much appreciated
    Thanks
    Pradnya07

    use expressions as below
    assuming this is to be done in SSRS
    Today
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Yesterday
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    LastWeek
    =COUNT(IIF(
    DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Last fortnight
    =COUNT(IIF(
    (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
    Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
    Last Month
    =COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Year To Date
    =COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
    And
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to fetch year till date value for earning for current ,last and year

    hi,
    how to fetch year till date value for earning for current ,last and year before that from payroll result
    plz reply soon,
    pratyush

    Dear Pratyush,
    Pick this from CRT.
    Use LDB PNPCE & Fire event GET PAYROLL &
    then you can pick from CRT.
    Hope this helps.
    Kindly reward in case useful.
    Regards & Thanks,
    Darshan Mulmule

  • Table for Year to date payments made to vendors

    Hi friends,
    I am generating one query, in which I have to show year to date payments made to vendors.
    can anyone tell me from which table and from which foield can I get this information.
    Please help.

    hi,
    GO to SE16 and select doc type wise , you will get a solution .
    i hope it helps you.
    regds,
    raman

  • HT2513 On iCal this year the date of shrove tuseday is showing on Tuesday 13 of February witch for a start is wrong coz it's a Thursday and wrong because its meant to be in march

    On iCal this year the date of shrove tuseday is showing on Tuesday 13 of February witch for a start is wrong coz it's a Thursday and wrong because its meant to be in march

    kaeandcolesmon,
    If you open the recovery drive (partition) it should only have a single folder (Recovery).
    To make sure that your not saving restore points to that drive.
    See:
    Start, Control Panel, System, System Protection tab. Make sure the D drive partition is set to OFF so that it does not save there.
    I am a volunteer. I am not an HP employee.
    To say THANK YOU, press the "thumbs up symbol" to render a KUDO. Please click Accept as Solution, if your problem is solved. You can render both Solution and KUDO.
    The Law of Effect states that positive reinforcement increases the probability of a behavior being repeated. (B.F.Skinner). You toss me KUDO and/or Solution, and I perform better.
    (2) HP DV7t i7 3160QM 2.3Ghz 8GB
    HP m9200t E8400,Win7 Pro 32 bit. 4GB RAM, ASUS 550Ti 2GB, Rosewill 630W. 1T HD SATA 3Gb/s
    Custom Asus P8P67, I7-2600k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX660 2GB, 750W OCZ, 1T HD SATA 6Gb/s
    Custom Asus P8Z77, I7-3770k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX670 2GB, 750W OCZ, 1T HD SATA 6Gb/s
    Both Customs use Rosewill Blackhawk case.
    Printer -- HP OfficeJet Pro 8600 Plus

  • Year to Date and Monthly totals

    I know that this is rather simplistic, but I'm new to Discoverer and need to set up a bunch of sales reports with MTD and YTD columns. I'm going to be using the same SQL query for many of my reports but customizing the reports to show sales by state, product line, etc.
    Is there a formula/function I can use in Discover for the Month to Date and Year to Date totals?
    Thanks,
    Joseph

    Hi Joseph
    You can use the analytic range SUM calculation for these. For the month to date, use the a PARTITION BY of month with a range of all the preceding rows in the partition up to and including the current row. For the year, you would simply change the PARTITION BY to be the year.
    Here are some examples drawn from my own database:
    I have the following items:
    ORDER_YEAR
    ORDER_MONTH
    ORDER_DATE
    SELLING_PRICE
    With these defined, the formula for month to date is:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS UNBOUNDED PRECEDING)
    The formlua for year to date is:
    SUM(Selling Price SUM) OVER(PARTITION BY ORDER_YEAR  ORDER BY  ORDER_DATE ASC  ROWS  UNBOUNDED PRECEDING )
    Basically what we are doing is telling Discoverer to SUM the SELLING_PRICE, and you should be able to take these and adjust them for your own report.
    Let me take a look at the month to end and describe what is going on. Basically the PARTITION BY is defining a set of rows which are to be included. In this case it is all rows that have the same ORDER_MONTH. The ORDER BY clause tells Discoverer to place the items in order, with the oldest order first. The ROWS UNBOUNDED PRECEDING tells Discoverer to SUM all of the items within the set (within the PARTITION BY) from the oldest item (UNBOUNDED PRECEDING) to and including the current item. We could have added a BETWEEN clause too but that is implied. With a BETWEEN clause it would look like this:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    If you want the current row to be included with UNBOUNDED PRECEDING you don't need to explicitly name it because that is the default. Other options you could use are these:
    UNBOUNDED FOLLOWING - this SUMS to the end of the PARTITION
    ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - you can guess that this will add all of the items, which you will rarely use because if you omit the ROWS command then this range between first and last is actually the default
    Rather than ROWS BETWEEN you can also say RANGE BETWEEN, like this:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    I hope this little dissertation on running totals helps.
    Best wishes
    Michael

  • Month to Date and Year to date calculation

    Hello Experts,
    It would be great If you could provide the formula to implement in BO universe or in the Reporting level for the below requirement.
    MTD, LastMonth, Year to Date, Last to LastMonth and examples are below.
    Last Week:
    Eg: Monday through Sunday
    Description: Based on Todayu2019s date, select the Monday of the previous week for the start date and Sunday will be the end date.
    Example:
    If Today is May 22, 2009
    The result would be, Monday = May 11, 2009, Sunday = May 17, 2009
    MTD:
    If Today is May 22, 2009
    I need a result MTD = May 1, 2009 u2013 May 21, 2009
    LastMonth:
    If Today is May 22, 2009
    I need a result LastMaont = April 1, 2009 u2013 April 30, 2009
    Last to LastMonth:
    If Today is May 22, 2009
    I need a result LastMaont = March 1, 2009 u2013 March 31, 2009
    Thank you.

    Nisniki,
    Here are the methods using WebI:
    MTD: 
    Create a local variable "MTD Start"
    =RelativeDate(LastDayOfMonth(RelativeDate(CurrentDate();-30));1)
    Create a local variable "MTD End"
    =currentdate()
    LastMonth
    =LastDayOfMonth(RelativeDate(CurrentDate();-30))
    Year to Date
    create a local variable "YTD Begin"
    =ToDate("01/01/"+FormatNumber(Year(CurrentDate());"####");"mm/dd/yyyy")
    (reuse "MTD End" or build a "YTD End" variable same as "MTD End")
    Last to LastMonth
    (similiar to MTD, but using "60" versus "30" to move back two months versus moving back 1 month.
    To perform this stuff in the universe requires an understanding of the SQL syntax for the paricular vendor your are working with.  ANSI SQL agrees to represent and compute dates uniformly, however, the functions to make it happen varies by the vendor.
    Thanks,
    John

  • Month to Date and Year to Date Scenarios

    <b>Dear SAP BI Gurus,
    Can anyone please give me guidance how to create a Month to Date and Year To Date Scenarios (Variables perhaps?) for 0SRR_CF_C1?  The date is in decimal and not DATE format…  I’m assuming the reason for this is to get the Time variance….  Nonetheless, I’d like to create a MTD and YTD scenario for reporting.
    Much Thanks
    Philips Manalaysay</b>

    Hi,
    You should take a look at the blog and doc below.
    /people/vikash.agrawal/blog/2006/10/17/enable-trend-reporting-150-by-manipulating-variable-value
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Regards,

Maybe you are looking for

  • Problem with Runtime R6025 in Adobe Illustrator

    have been reading forums, doing multiple solutions as suggested by your staff and other people online with no success. I will illustrate the problem to you, but may be worth checking Illustrator as I think it's a bug. I have a file with 2 artbords at

  • Unable to upload file more than 2 MB

    Hi I am trying to uplaod a file to Oracle DB using struts . The file is being stored as a blob datatype . When the file-size is more than 2 MB the file does not get uplaoded . The property mapped to the form attribute returns null . IBelow is part of

  • JSF + Facelets + Tomahawk: ExtensionsFilter not correctly configured.

    Hello, I want to use JSF with facelets and tomahawk... I have a standard facelets configuration like the demo on their website... But at the moment, there is a tomahawk component in one of the pages I get the following error: java.lang.IllegalStateEx

  • SD card driver not reading

    My Sony vaio is not reading my SD card from my camera. I installed the software updates and it didn't do anything. I checked under devices and drivers and it says the software is working.. but it's not. The SD drive has worked before, so I don't unde

  • Calling SQL statement from a script problem

    Hello, I have a script e.g query.sh: #!/bin/sh sqlplus -s ${ORACLE_USER} << HIC set heading off set newpage none SELECT 'ALTER TABLE '||'TEST_TABLE'||' ADD PARTITION '||' P'|| TO_CHAR(TRUNC(sysdate+7), 'IYYY')||'W'|| TO_CHAR(TRUNC(sysdate+7), 'IW')||