Calculating difference

I filtered my data to display only Current Year and Last Year records and displayed them in a pivot table. In the last column i have a requirement to display difference between amount of current year and last year. How should i calculate this ?? i am unable to access both records ( for current year and last year) in one column.
I am trying to display records in the following format.
Account Name Order Qty       Purchase Price                         Diff
*2009 2010 2009 2010*
Test Account 14 16 1600.00 4995.00 ???
any help on this will be much appreciated.
Thanks,
Arshad

If you are hard coding the values to 2009 and 2010 then it should be pretty straight forward.
Try the below:-
Use all these columns in the Measure Section NOT in the Rows section
Column This Year: CASE WHEN Year = '2010' THEN Display This Year Record ELSE END
Column Last Year: CASE WHEN Year = '2009' THEN Display Last Year Record ELSE END
Difference : (CASE WHEN Year = '2010' THEN Display This Year Record ELSE END)-(Column Last Year: CASE WHEN Year = '2009' THEN Display Last Year Record ELSE END)
Aggregation rule = MAX, see what works for your requirement
Hope this helps!
-Royston

Similar Messages

  • Expanding table: Calculating difference to value from previous row

    Hi there,
    I am a complete newbie to LiveCycle Designer (ES2) and have created below document with an expanding table.
    Shared Files - Acrobat.com
    My aim is to make the form user friendly by adding a calculation in the field "Twist" which calculates the difference from the current row to the previous row.
    I have no idea about Java Script, I am afraid, and also don't know if this is possible at all so it's probably a bad idea after all.
    The reason for setting it up as an expanding table is so that the form can be used for all 32 instances the form would be used for (they would all require different amount of rows altogether).
    The calculation would start in row 2 (Checklist.Table1), take the twist value entered in row 2 and calculate the difference to the twist value entered in row 1.
    Then in row 3, it would calculate the difference between twist value in row 3 to row 2 etc.
    So subtract value of field in rown with value in rown-1 or something in this direction.
    Is there anyone at all who could help me with this at all?
    I'd be very grateful for any advice you could give me.
    Thanks a lot!
    Mathilda

    Not sure what happened with the formatting there, try this;
    if (Row1.index > 0 && !Row1.resolveNode("NumericField4[0]").isNull)
        var prevTwist = Table1.resolveNode("Row1[" + (Row1.index - 1) + "].NumericField4[0]").rawValue
        var result = Math.abs(3000 / (Row1.resolveNode("NumericField4[0]").rawValue - prevTwist));
       this.rawValue = result;
    else
        this.rawValue = "";

  • Calculating difference in Time using Javascript, etc.

    I have an employee timesheet application where a clerk occasionally has to manually add a line. In the DB table, there are START_DATETIME and STOP_DATETIME fields (TIMESTAMP datatype) and the difference between these is the number of hours the employee gets paid for (obviously).
    Right now, I have two calendar controls on a form (thanks for the updates in APEX 3.0 that improve TIMESTAMP handling BTW) to allow them to input these.
    What the clerk wants to be able to do is select a START_DATETIME using the calendar control (easy) and then have the STOP_DATETIME calculated based on a third field - MINUTES. Anyone got any good ideas on how to do this, since (I think) it will have to be done client-side in JavaScript?

    OK, here's what I ended up with:
    function calc_time()
    var oneMinute = 60 * 1000; // milliseconds in a minute
    var oneHour = oneMinute * 60;
    var oneDay = oneHour * 24;
    // Get the IN_TIME value
    var fld_in_time = document.getElementById("P27_START_DATETIME");
    var var_in_time = new Date(fld_in_time.value);
    // Get the Minutes, Calculate a new time
    var fld_mins = document.getElementById("P27_MINS");
    var var_new_time = var_in_time.getTime() + fld_mins.value * oneMinute;
    var var_out_time = new Date(var_new_time);
    // Debugging
    //var fld_test_time = document.getElementById("P27_NEW_TIME");
    //fld_test_time.value = var_out_time;
    // Concatenating the OUT_TIME value
    var fld_out_time = document.getElementById("P27_STOP_DATETIME");
    var v_mm = var_out_time.getMonth();
    if(v_mm < 10){
    v_mm = "0" + v_mm
    var v_dd = var_out_time.getDate();
    if(v_dd < 10){
    v_dd = "0" + v_dd
    var v_yyyy = var_out_time.getFullYear();
    var v_date = v_mm + '/' + v_dd + '/' + v_yyyy;
    var v_hh24 = var_out_time.getHours();
    if(v_hh24 < 10){
    v_hh24 = "0" + v_hh24
    var v_mm = var_out_time.getMinutes();
    if(v_mm < 10){
    v_mm = "0" + v_mm
    var v_time = v_hh24 + ':' + v_mm;
    fld_out_time.value = v_date + ' ' + v_time;
    }

  • Calculating difference of Tax in pricing procedure

    Gurus,
    Please provide me suggestions for the scenario below:
    There are two tax condition types ZX1 and ZX2 in my pricing procedure. ZX1 and ZX2 are the same tax type but coming into SAP from two different systems. One is from the e - commerce platform and other is from some tax system. We want to use one condition type as statistical and use for reporting purpose.
    What I basically need is to in someway calculate the difference between these two condition types and store value somewhere in the pricing. We will use that for reporting.
    1.  Source 1 Example (E-commerce) ---> ZTX1  $1.00
    2.  Source 2 Example (Vistex/Sabrix etc) ---->ZTX2  $2.00   (Statistical)
    Thanks,
    Manoj

    Dear Manoj,
    SAP has provided multiple Sub Total fields starting from KZWI1 to KZWI6 field. If you will assign any of sub total field from 1 to 6 to difference of condition type calculated line in pricing procedure, system will store in VBAP-KZWI* field.
    You can use the same for your reporting perspective.
    Regards,
    MJ.

  • [Urgent] Need help calculating difference between two dates

    I'm trying to write a code to display the current day and time, then accept two dates from the user and display the difference between the two dates. To display the current date and time, I've used the SimpleDateFormatter library but I'm having difficulty calculating the difference between two dates. Could someone please help me with this?
    Below is my code so far
    import java.util.Date;
    import java.util.Scanner;
    import java.text.SimpleDateFormat;
    public class DateFormatter {
         public void displayNow()
              Date todaysDate = new Date();
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
              String formattedDate = formatter.format(todaysDate);
              System.out.println("Today's date and time is: "+formattedDate);
         public void calculateDifference(Date startDate, Date endDate)
              /* This is whre i need help! */
         public static void main(String[] args)
              DateFormatter df = new DateFormatter();
              Scanner sc = new Scanner(System.in);
              df.displayNow();
              System.out.println("Please enter a date: ");
              String date1 = sc.next();
              System.out.println("Please enter another date: ");
              String date2 = sc.next();
    }The methods displayNow() and calculateDifference(Date startDate, Date endDate) are essential and cannot be skipped out.

    tarahmarie101 wrote:
    Dude. I've tried doing assignments under pressure, and it doesn't work. Here's a piece of free advice. Start earlier next time, don't put "urgent" in the title of your post b/c it just pisses people off around here--and is a sure sign of an overdue homework assignment which no one around here likes helping with, and try to ask intelligent questions--don't just say "Help me!"
    Of course, it takes some time to learn what the intelligent questions are. You have my sympathy. Try asking questions about how to do a particular task, instead of asking people to tell you what to do. It starts to get easier after a while.
    actually dude i started on this on monday.. but there were so many other stuff to do along with this.. and i did try referring up the Calendar utility but it was a bit confusing actually.. it was only after that did i come to this forum.. nor am i very good at Java.. anyhoo thanks for your sympathies :P

  • Calculating difference between two dates in Variable Exits

    Hi,
          I need to calculate the difference between the two dates in months in Variable exits. I want the result in months so that I need to find out the Average Usage.
            How can I find the difference between them in months.
    Thanks
    Dave.

    Hi Christophe, Senthil
                                       Sorry for late response, I checked this  MONTHS_BETWEEN_TWO_DATES_NEW  in SE37/SE38 and about the date they are going to enter at query run time it should be like 03/03/2006 to 08/03/2006 and I should get in 5 months and or if the date range 03/15/2006 to 08/03/2006 and I should get like 4.5 months. Please could you tell me how to get the values in months or please give me a functional module so that I can use.
    Thanks
    Dave.

  • Calculating difference of a single date field

    Greetings
    I have a table as below
    Test_case_id Execution_Date Execution_id
    100 7/1/2009 1
    100 7/5/2009 2
    100 7/20/2009 3
    I want to write a query that gives me the no of days between two executions.
    I want the result to be like
    4 days (between the first two executions)
    15 days (between the next two executions)
    Please help

    You can try:
    with t as(
    select 100 as Test_case_id, to_date('7/1/2009', 'mm-dd-yyyy') Execution_Date, 1 Execution_id from dual union all
    select 100 as Test_case_id, to_date('7/5/2009', 'mm-dd-yyyy') Execution_Date, 2 Execution_id from dual union all
    select 100 as Test_case_id, to_date('7/20/2009', 'mm-dd-yyyy') Execution_Date, 3 Execution_id from dual)
    select to_char((select min(execution_date)
                 from t  t2
              where t2.execution_date > t1.Execution_date) - t1.Execution_Date)||' days' Diff
    from t t1
    where t1.execution_date < (select max(execution_date)
                  from t  t2 )
    DIFF
    4 days
    15 daysMiguel

  • Exchange Rate Difference Posting

    Dear Gurus,
    I am facing atypical scenario in Production and development Clients.While clearing open items for a BanlK GL (USD Currency) in production there is no exchange differences being calculated by the syste.There is difference in Exchange rates between the original document and the clearing document.
    But for the same GL in Development I am getting Posting to Account maintained in KDB Key.
    I would like to know what can lead to difference in scenario that in one case system is calculating difference and posting and in the other case no.
    Please help.
    Regards
    Raju

    Dear All,
    Let me elaborate the scenarion in more deatil:
    We post Foreign Currency Invoice LIV--MIRO say rate is 41 USD/INR
    For payment F110 No Exg rate differences is selected in FBZP--So no Exchange Rate Difference is posted for payment.
    Now for clearing the bank Sub account Entry posted by APP user input LIV Exg rate in past and systen allowed to clear with no Exg rate Differ.This is OK.
    Now when user try to clear same account with same entry system is issue msg like No Exg Rate diss account maned.I tried to clear th GL document with both LIV and APP exchage rate its strange that is each case system expects Exchange rate diff account.
    I maintained in FBKP KDB in development client but then Exg Rate diff is getting posted which is not the requirement.
    Can any body please help.
    Regards
    Raju

  • How to get date difference in data sources

    Hi,
    In SQL:SELECT DATEDIFF(day, '2005-12-30 23:59:59.9999999', '2005-12-30 00:00:00.0000000');
    output :1
    As similar way how get the datediffence in SAP business by design of the datasources.
    Regards,
    Prasad

    Hi Prasad,
         For this you have to create a Custom DATA SOURCE for the required BO. Then Select all the required fields that you want to use it in the report for that datasource.
    The 3rd step of Data Source Wizard is shown in the image, here you can add a extra field that can hold the difference between the DateTime elements present in the BO.
    In the left column BUSINESS OBJECT ELEMENT choose DATE element (1st Date).
    In the right column TRANSFORMATION choose DateTime To Duration row and in the PARAMETER Column choose the field against which you want to calculate the difference.
    In Defined Field Name enter a name, this will hold the value of the calculated difference.
    Thank You
    Shabaz

  • Simple Calculations in BPS Web

    Hi,
    I am using the BPS web layouts (ALV Grid not the Excel Web Component). I would like to add a couple of very simple calculations (difference of columns/percentages etc). Is it possible to do this without using the Excel OWC ?
    Thanks
    Shailesh

    Hi
    the simplier way to achieve yor result is to use FOx formula to calculate your results at runtime .
    You should create a formula function and add FOX code to it .
    Check this link for examples
    http://help.sap.com/saphelp_nw04/helpdata/en/d3/8057f830a911d4b2be0050dadfb23f/frameset.htm
    Hope it helps
    Andr

  • How to get the difference between two dates???

    HI I have two dates and I want to test if there is an hour between them.
    Is there a way to compare two dates like mySQL can with dateDiff(date1,date2);
    Thanks alot.
    Graham

    This link is now out of date as they have revamped the structure. Yep. Here it is again: http://forum.java.sun.com/thread.jsp?forum=31&thread=502686
    I've also noticed that my comment regarding daylight saving was misleading. The demonstrated method for calculating difference between Dates is reliable. However, one needs to be careful when interpreting Dates in a daylight saving timezone.

  • Billing calculation

    Hi,
    I have created retro billing invoice . While creating i have came across few doubts :
    1) Ex: From 01-01-2012 TO 15-01-2012 AA material cost is 100/- . Now it has raised to 150/- . So i have maintained 150/- in vk11 with From 01-01-2012 TO 15-01-2012 periods and done the billing etc..
    My doubt is how system calculates the difference price ( 50/- ) here because when i see the invoice ( CREDIT/ DEBIT NOTE) which i have created through VFRB the price is 50/- for material. Means it is picking up the difference amount only.
    2) For PDIF condition (As per my search in forum's and Google) suggesting that Under PR00 Step we have to place no need to take any requirement Only Manual check and Subtotal 'F' Is enough With ERL.
    My doubt is how system picking the values to hit the concerned G/L Account.
    I tried in GOOGLE AND FORUMS too but i couldn't find the answer. Expecting answers which can clarify my doubts.

    Hi
    The system calculates the value simply by firstly confirming the new condition values.
    Then it calculates the difference between the old and new to determine if a debit
    or credit is required.
    In the pricing you should expect to see the new condition value set to inactive in
    (field KINAK)  and the calculated difference between the old and new is transferred
    to the PDIF condition which will be the only active price condition.
    The account determination happens from the customising in VKOA as in all other
    cases.  The key assigned to the PDIF condition is the link to the account found
    In the standard pricing procedure RVAA01 this is ERS
    You can see the account determination in the SD/FI interface
    RV_ACCOUNTING_DOCUMENT_CREATE
    START OF : account determination
        call function 'RV_INVOICE_ACCOUNT_DETERM'   >>>
             >> CALL FUNCTION 'ACCOUNT_ALLOCATION'
    You have user exits RV60AFZZ to prepare the account determination fields
    if required and user exit EXIT_SAPLV60B_008 is also availablewhere you could
    manipulate the XACCIT-HKONT field value if you have a custom business requirement 
    I hope this helps you further
    Kind regards
    Brian

  • WIP-Work in Process

    Hi Experts,
    Please tell me what is exact WIP in production order settlement. Why it is need to Calculate WIP using Tcode : KKAX - Individual Processing.Pls don't suggest SAP library.
    I don't want defination of WIP.If possible explain with example.
    Vipul.

    Dear,
    WIP means work in process material..
    WIP Calculation --- difference between the debits and credits of an order as at the period end when you calculate WIP.. in other words, it is the value of undelivered stock from an order. It is always calcualted in term of currency not in term of quantity.
    When you need to display the value you can use transaction KKAY orKKAQ.
    When you WIP calculation system will calculate the production cost incurred till that time w.r.t. different cost element(direct cost indiredt cost/material and activity) and updated to different accounts.
    Hope clear to you.
    Regards,
    R.Brahmankar

  • WIP work in process in PM/CS orders

    Hi everybody,
    Reading the concepts of the use of WIP, is mentioned that it can be applied also in services:
    http://help.sap.com/saphelp_40b/helpdata/es/89/a42c7a461e11d182b50000e829fbfe/content.htm
    I have been working with PM/CS, and the cycle ends with the billing of the sales document that is generated from the service order, but i have problems applying the settelment rule, because i only use one G/L account and Financial area teold me that i must be work with 2 G/L accounts, one for the service in process and the other when the service finishes.
    By the other hand, also they mentioned that i have to determine the sales cost from the settlement of the general order.
    Can somebody help me?

    Dear,
    WIP means work in process material..
    WIP Calculation --- difference between the debits and credits of an order as at the period end when you calculate WIP.. in other words, it is the value of undelivered stock from an order. It is always calcualted in term of currency not in term of quantity.
    When you need to display the value you can use transaction KKAY orKKAQ.
    When you WIP calculation system will calculate the production cost incurred till that time w.r.t. different cost element(direct cost indiredt cost/material and activity) and updated to different accounts.
    Hope clear to you.
    Regards,
    R.Brahmankar

  • Requirement of VBA coding faced in the real time??

    Can anyone explain some of the senarios for Transfer Rules, Update Rules and Start Routines and what was your approach for it.

    Hi chandran,
           go through thes links for details
    transfer routine
    Date key figure: Convert DATS format to DEC format
    Date Conversion in Flat File
    Transfer Routine ABAP
    conversion exit
    Date Conversion
    Problem with  conversion char to numc in transference rules
    conversion routine..?
    start routine in transfer rules
    Look up to load master data
    excluding
    Start Routine in Transfer Rules
    Sample code in Update Rule to restrict data selection?
    Append Datapak - transfer start routine
    Excluding Blank field in Infopackage Filter
    Trans Routine ABAP help ..
    update routine
    How to call a function in Update Rules to reverse a key figure sign
    Need Sample Code for Update Rules
    Date calculation
    Difference between data in PSA and Data in Infocube
    No RETURNCODE <> 0 allowed in update routines in transfer mode
    the diffrerece between DEC and (yyyymmdd) 8 char in Time defination
    Access master data in update rules
    Date key figure: Convert DATS format to DEC format
    start routine in update rules
    Is it possible to read a third ODS in update rules between two ODS?
    update rule coding while loading data from ODS to CUBE
    Start Routine in Update Rules to populate additional fields from ODS
    Coding in Update Rules accessing a Z-Table
    Start routine
    Thanks
    @jay

Maybe you are looking for

  • Decimal values are not flowing to Excise Invoice created in J1IIN

    Dear Sap Gurus, Please help me with the problem. After creation of invoice in VF01 when i am creaing outgoing excise invoice decimal values for BED, ECS and SEC. ECess( AT1) are not coming instead values are rounded of to nearest whole number. for ex

  • Error in MAIN_SHDRUN/ACT_UPG

    Hi, I am doing an EHP6 upgrade and I am getting an error in the MAIN_SHDRUN/ACT_UPG phase. The error directs me to the SAPup.ECO file. Please find the contents of this file below. Please assist. FSAPup> Starting subprocess at 20120607070947     ENV:

  • Wat will happen if.................................

    if i restoer my ipod, will i loose all my songs in my computer library????? video 30gb   Windows XP  

  • Solaris 8/9 with LDAP

    I setup iplanet directory server in the Solaris 9. Solaris 9 client can get user account, automount data from LDAP, but , Solaris 8 can't get automount data, If cd /test4 , error message : permittion denied. How to fix it , or to get more information

  • MR21 - Is there configuration for the screen layout?

    We want to make the Reference and Document Header Text fields in MR21 mandatory.  Is there anywhere in configuration that this can be accomplished?  We've looked everywhere...