How should calculate  variance between dynamic input?

HI  Experts,
how should calculate Actual cost varience  between two month.

Hi
From the screen shot it says only u r using 2 months here.
But if you are running for year,then this can be the steps.
1.sort month ..go to values and the arrange .
2.The data should display properly monthly wise
3.Then If you have direct month object then create Previous([Month]).we have previous function
4.write Diff=[Actual Cost]-Previous Actual Cost

Similar Messages

  • How to calculate variance between two dimension values

    Hello:
    I have built a cube in Analytical workspace (9.2.0.5) with 3 dimensions. Time, Product & Scenario. I am using BI Beans (thick client) for the presentation layer. What I need is the ability to calculate the variance between two dimension values of same measure. For example, if My scenarios are 'Actual' and 'Budget', when I present the results on the screen for any measure (e.g Total Sales), I should be able to calculate & display the difference between 'Actual' & 'Budget' values of that measure.
    I have more than 7 scenarios and more than 40 measures. It could even be the difference between two product categories. How do I do it either in AW or at BI Beans Level?
    Thank you very much for your help.
    regards
    Suresh

    You want to look at qualified data references in the OLAP DML references. Basically, any data reference may be qualified by specifying a dimension name and value:
    sales(time 'jan92')
    forces the dimension TIME to the member 'jan92', no matter whether 'jan92' is in status or not. The resulting expression is essentially no longer dimensioned by the dimension TIME.

  • How to calculate days between two DATES

    How to calculate days between two DATES ?
    which is the functional module for that ?
    help me

    Hi,
    use function module : it works,
    HR_HK_DIFF_BT_2_DATES
    give output format = 03 and get the value in days.
    code is as below :
    data : DATE1 type P0001-BEGDA,
    DATE2 type P0001-BEGDA,
    YEARS type P0347-SCRYY,
    MONTHS type P0347-SCRMM,
    DAYS type P0347-SCRDD.
    date1 = '20070331'.
    date2 = '20070101'.
    CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
    EXPORTING
    DATE1 = date1
    DATE2 = date2
    OUTPUT_FORMAT = '03'
    IMPORTING
    YEARS = years
    MONTHS = months
    DAYS = days
    EXCEPTIONS
    INVALID_DATES_SPECIFIED = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write : days.
    Reward points, if helpful,
    Regards,
    Sandeep Kaushik

  • How to calculate hours between two dateTime node in BPEL.

    In my BPEL there's a requirement need calculate hours between two dateTime type..
    I tried 2 solutions, both of them failed:
    1. use xslt calculate duration(xml type, like PT12H) between two dateTime, and then use embedded java code to get the hours.. The problem is : I need to parse the xml duration format...(like this real one: -P80DT17H47M36S....), and to parse it in java , maybe have the same problem with solution 2..
    * [Subtracting 2 dateTime values into a duration using XPath 2.0|http://blogs.oracle.com/rammenon/2007/07/subtracting_2_datetime_values.html]
    2. use embed java code, but it seems we can't use some class in embedded java code:
    my code(input begin, end both dateTime in xml. output: diff, int in xml):
    1 System.out.println("\n\nTimeTestBegin");
    2 String begin=getVariableData("begin").toString();
    3 String end=getVariableData("end").toString();
    4 System.out.println(begin+"-----"+end);
    5 //Class c1=Class.forName("javax.xml.datatype.XMLGregorianCalendar");
    6 //Class c2=Class.forName("javax.xml.datatype.DatatypeFactory");
    7 //System.out.println(c1.getName());
    8 //System.out.println(c2.getName());
    9 javax.xml.datatype.XMLGregorianCalendar beginTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(begin);
    10 javax.xml.datatype.XMLGregorianCalendar endTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(end);
    11 long diff=beginTime.toGregorianCalendar().getTimeInMillis()-endTime.toGregorianCalendar().getTimeInMillis();
    12 setVariableData("diff",String.valueOf(diff/1000/3600));
    13 System.out.println("DIFF======"+diff/1000/3600);
    14 System.out.println("TimeTestEnd");
    it's said can't compile java class, but can't find the detail error, I think the problem is how to import java class to embedded java code activity(use full package name like above code don't work), when I remove line 9-13, no compile error..
    BTY: Jdeveloper is a IDE support java, but why the embedded java activity's edit window only have a simple "java code" editor, too simple that it can only edit you code snippet...
    3.There's another sulotion: extend BPEL xpath functions(add a new function), but in my project, modify BPEL server(soa server)'s config file is not allowed..
    Anyone know easy solution to my problem?
    Thanks.

    Hi, All,
    I found the cause. Sorry, it's my mistake..
    below line have a DatatypeConfigurationException:
    javax.xml.datatype.DatatypeFactory.newInstance()
    When I test my java code snippet, I coped the code snippet to one of my java class in eclipse, and put it in a method to check if there's compile error, but I didn't notice there's a "throws Exception"...
    the final java code snippet for test is :
    input: begin dateTime
    input: end dateTime
    output: diff int, how many hours in (begin-end)
    try{
    System.out.println("\n\nTimeTestBegin");
    String begin=getVariableData("begin").toString();
    String end=getVariableData("end").toString();
    System.out.println(begin+"-----"+end);
    javax.xml.datatype.XMLGregorianCalendar beginTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(begin);
    javax.xml.datatype.XMLGregorianCalendar endTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(end);
    long diff=beginTime.toGregorianCalendar().getTimeInMillis()-endTime.toGregorianCalendar().getTimeInMillis();
    setVariableData("diff",String.valueOf(diff/1000/3600));
    System.out.println("DIFF======"+diff/1000/3600);
    System.out.println("TimeTestEnd");
    }catch(Exception e){
    e.printStackTrace();
    }

  • How to calculate days between 2 dates excluding public holidays over SAP ?

    Hi
    Have a universe over SAP data. Trying to calculate days between 2 dates. SAP holds Public Holiday data in various tables e.g  Thol and data is updated via scal. Using my univeres as a source I want to run  reports for different countries so need to have various bank holidays not just UK. In SAP function modules handle this. Has anyone designed a solution to cater for this situation in a universe ?
    Thanks in advance
    M

    Hi,
    I assume you mean SAP R/3 (ECC) when you write SAP and SAP BW.
    Are you using BW? If so, I would load the data into SAP BW, create a query using customer exit variables and build your universe on top of that...
    -J

  • How to calculate difference between date in hours?

    Hi All.
    I need calculate difference between first and last date. I'm using the code below:
    int differenceDate = CalendarRule.elapsedDays(fromDate : myFirstDate, toDate : myLastDate);
    This code return an result in days. But I need that result was in hours.
    Has anybody help me?

    Interval dif;
    dif = myLastDate - myfirstDate;
    display((dif.hours));
    Hope it helps

  • How to calculate period between date/time?

    All,
    I have not been able to find any function module that does this.
    I have a create date/time from a table (VBAK).
    I need to calculate the difference in days/hours/minutes (seconds not needed) between the date in this table and the current date/time.
    Then based on the result - e.g. difference is say 2 days 3 hours and 50 minutes - I will compare to a comfigured period users input to determine record selection.
    I can get date difference - SAP handles that - but the hours and minutes are a different story.
    Thanks.
    Scott

    No Matters if problem solved by own. Surely Posting a solution would help others needed person in future .

  • How to Create a Rich Dynamic Input and Output PDF to insert and get data into, from Database (MSSQL)

    HI ,
    I want to use Adobe LiveCycle Designer and Adobe LiveCycle Workbench features to create a Dynamic PDF form which can allow me to store data into database(MSSQL Server) and Can also provide me the Output PDF form with all the information which has been been filled in by the User in input form. Both Input and Output forms must be Dynamic. I am stuck in this process and Need Experts Advice on the Complete optimal process flow of the Adobe.
    Regards
    Ritesh Grover

    HI
    Go to the lay out of your screen and doublr click on the table control fields, you can get the Properties/Attribute of the screen or table control Fields
    Assing a Group GRP1 for all the fields i n the table control.
    in PBO
    if ok_code = 'INPUT'.
    LOOP AT SCREEN.
    IF screen-grp1 = 'GRP1'.
    screen-input = 1.
    modify screen.
    endif.
    ENDLOOP.
    elseif ok_code = 'OUTPUT'.
    LOOP AT SCREEN.
    if screen-grp1 = 'GRP1'.
    screen-input = 0.
    modify screen.
    endif.
    endloop.
    endif.
    Regards
    Ramchander Rao.K
    Edited by: Ramchander Krishnamraju on Aug 8, 2009 5:27 AM

  • How to calculate variance in process order?

    hi
    i hav standard report ME1P,  i need to do some modifications in this standard prgrm
    i did all modifications except variance calculation...
    can any one expln me the logic of below code?
    IF xeipa-lprei IS INITIAL.
          IF xeipa-peinh NE 0.
            new_eipa_netpr = xeipa-preis / xeipa-peinh.
            new_eipa_peinh = xeipa-peinh.
          ELSE.
            new_eipa_netpr = xeipa-preis.
            new_eipa_peinh = 1.
          ENDIF.
          new_eipa_preis = xeipa-preis.
          new_eipa_waers = xeipa-bwaer.
        ELSE.
          IF xeipa-lpein NE 0.
            new_eipa_netpr = xeipa-lprei / xeipa-lpein.
            new_eipa_peinh = xeipa-lpein.
          ELSE.
            new_eipa_netpr = xeipa-lprei.
            new_eipa_peinh = 1.
          ENDIF.
          new_eipa_preis = xeipa-lprei.
          IF xeipa-lwaer NE space.
            new_eipa_waers = xeipa-lwaer.
          ELSE.
            new_eipa_waers = xeipa-bwaer.
          ENDIF.
        ENDIF.
        refe1 = old_eipa_preis * new_eipa_peinh.
        refe2 = new_eipa_preis * old_eipa_peinh.
        IF refe1 NE refe2 OR old_eipa_preis EQ 0 OR
             i_allekz NE space OR old_eipa_waers NE new_eipa_waers.
          IF old_eipa_waers NE new_eipa_waers AND old_eipa_waers NE space.
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
              EXPORTING
                date             = xeipa-bedat
                foreign_amount   = new_eipa_netpr
                foreign_currency = new_eipa_waers
                local_currency   = old_eipa_waers
              IMPORTING
                local_amount     = wae_eipa_netpr.
            wae_eipa_waers = old_eipa_waers.
          ELSE.
            CLEAR: wae_eipa_netpr, wae_eipa_waers.
          ENDIF.
         PERFORM variance_cal.
         old_eipa_netpr = new_eipa_netpr.
         old_eipa_preis = new_eipa_preis.
         old_eipa_peinh = new_eipa_peinh.
         old_eipa_waers = new_eipa_waers.
      ELSE.
         DELETE xeipa.
      ENDIF.
    IF wae_eipa_netpr EQ 0.
        IF refe1 NE refe2 AND old_eipa_preis NE 0.
          IF old_eipa_preis NE 0.
            refe1 = ( new_eipa_preis * old_eipa_peinh -
                      old_eipa_preis * new_eipa_peinh ) * 1000 /
                    ( old_eipa_preis * new_eipa_peinh ).
            IF refe1 LE 999999.
              abweichung = refe1.
            ELSE.
              abweichung = 999999.
            ENDIF.
          ELSE.
            abweichung = 0.
          ENDIF.
        ENDIF.
      ELSE.
        IF wae_eipa_netpr NE old_eipa_netpr AND old_eipa_netpr NE 0.
          IF old_eipa_netpr NE 0.
            refe1      = ( wae_eipa_netpr - old_eipa_netpr ) * 1000
                         / old_eipa_netpr.
            IF refe1 LE 999999.
              abweichung = refe1.
            ELSE.
              abweichung = 999999.
            ENDIF.
          ELSE.
            abweichung = 0.
          ENDIF.
        ENDIF.
      ENDIF.
      IF sy-subrc is INITIAL.
        wa_final-abweichung = abweichung.
      ENDIF
    Regards
    Smitha

    Hi,
    It all depends on how you want the freight to be calculated (Eg: Volume based, Weight based etc.). Please share the business requirement.
    Regards

  • How to Calculate Differance(-) between to UDF in New UDF From Same table

    Hi Expert,
        I have created three UDF on WTR1 and I want to calculate Diff of two UDF and that value will be shown to the third UDF
    what should be query for for FMS for that....
       I have write Select $[wtr1.U_Transmain]-$[wtr1.U_Tranns1] from WTR1 But this query is not working properly...
       Please give me suggestions...
    Regards,
    Sandy

    Use this Query
    SELECT ((cast( $[wtr1.U_QtyTrasMain]as decimal(10,2))) - (cast ( $[wtr1.U_QtyTrans1]as decimal(10,2))))
    And use UDF type Unit and Totals and select  Quantity  type.
    and Set auto refresh on U_QtyTrans1
    Thanks
    Mohammad Imran

  • How to Calculate second between two dates?

    I'm wish to create a ref ID using seconds between two dates as the uniue number. I usually use DateDiff function in VB to calculate the ref ID. But now instead developing using VB, i'm using java in developing my project. I wonder is there any class similar to the datediff function? Please advice.Thank you

    diff_sec =( Date1.getSeconds() - Date2.getSeconds());

  • Variance key for calculating variance between planned price and actual cost

    Hello CO Experts,
    I am not following standard cost estimate. I am using price control V for FG. Now I did all the process:
    1. Process Order creation
    2. Process Order confirmation
    3. Template Execution
    4. Process Order revaluation
    5. Process Order - TECO.
    Now when I am running KKS2 (Variance), system is giving following error:
    Only remaining var. in version 0 - no target costs for 000001000047
    It means system is searching target cost in process order. However, since I didn't executed standard cost, system will populate target cost. Hence my requirement is that the system should calculate variance with respect to planned cost.
    Also I have assigned variance key to target version  1. In that assignment, I have selected "planned / preliminary cost"  in target cost section.
    When I am running KKS2 (variance analysis), system is calculating for both versions. Because of this, it is giving error. There is no input parameter, where I can give specific version.
    Please help

    Hi Deepak,
    For Finished Goods materials  if you assigned Price control  V (Moving Average) it is irrelevant  to run the Standard Cost Estimation.
    My earlier client we don't have variance because of the Moving Average Price for Finished Goods.
    Please check, It is really required Variance??  If it is required check whether variance key is automatically assigned to Process order or not. (Control Tab)
    Ravi Polampalli

  • Calculate the variance between quarters and store it in a scenario

    Hi,
    Can anyone suggets how I can write a rule to calculate the variances between quarters, Qtr1 vs Qtr2, Qtr2 vs Qtr3 etc, and store them in a scenario so that I dont calculatethem on a report ?
    Thanks,
    IK

    Hi. Why don't you want to do this on the report - it's much easier and you can get favorable/unfavorable comparisons? But, if you want to do the rule, here's the approach.
    Create the scenario with QTD as the frequency so you don't have monthly periods
    Limit the rule to run just for the scenario and don't run any other rules for the scenario
    Use a select case to determine which period (Q1, etc.) is being calc'd to populate variables that contain the source period and year (for going back a year to Q4).
    Write the rule to compare data from current quarter in the real scenario to the prior quarter in the real scenario. Something like HS.Exp "A#ALL = A#ALL.S#Actual.P#Jun.W#QTD - A#ALL.S#Actual.P#Mar.W#QTD. But, you may want to adjust this to calculate a favorable/unfavorable variance on the revenue/expense accounts, so you'd need to loop through the accounts and look at the account type.
    You'd want to rerun the rule at all value members for both base entities and parent entities. May need to clear all existing data (HS.Clear "A#ALL") in the scenario/year/period/entity/value first.
    Do a consolidate all on the scenario to pull the data across and do the math
    Have fun, but you really should still with doing the comparison in the reports.
    Eric

  • Discount should calculate on VAT/CST in MM Pricing procedure.? or How to write  routine to calculate discount amount after VAT/CST .?

    Hi All,
    Client is asking discount should calculate after Base+ED+VAT/CST. How to achieve this by configuration or by creating routine?
    I am reading Discount amount from condition tab but not able to deduct it after VAT in Routine.

    Hi
    P is the price of the product
    Y is the MRP
    P&F = x1.P (x1 of P)
    ST = x2.P (x2 of P)
    ED = x3 .P (x3 of P)
    x1 x2 x3 are constants. P = Y/(1x1x2+x3)
    P&F=x1P, ST = x2.P ED=x3P
    You have mentioned that all the pricing is based on MRP. Hence you will entering MRP as input price. Now P will be selling price before taxes and discounts. P&F, ST and ED will be always mentioned as % of Product and not MRP. So considering the equation
    P + P(x1x2x3)=Y
    Hence P = Y (1x1x2+x3) and hence further calculations.
    Now in V/08 you can maintain pricing procedure. Here alternate calcualtion type will be routine which you can create new and add to the step.
    Hope now its clear.
    Kind regards
    sandeep

  • How to calculate  number of sundays and saturdays between two Dates

    friends i want to calculate how many Sundays come in two Dates
    i have tried following code which is hard coded i have to impliment method which can give me number of Sundays between two Dates
    please help me
    import java.util.Date;
         import java.text.DateFormat;
         import java.text.SimpleDateFormat;
         import java.util.Calendar ;
         import java.util.GregorianCalendar;
    public class DateDiffCalculator     {
         private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MMM-dd");
    public DateDiffCalculator()     {
         public static Date getDate (String date) throws Exception {
    //log.debug(" "+date);
              return SDF.parse(date);
    public static Date getDate (Date date) throws Exception {
    // log.debug("date is "+date);
              return getDate(SDF.format(date));
    public static long getDiffInDays(Date d1,Date d2)     {
         boolean isdiffGreaterThanYear=false;
         long diffInMilliSeconds=d1.getTime()-d2.getTime();
         return diffInMilliSeconds/(1000*60*60*24);
    public static int getYear(String date)     {
              //String[] day=     {Sun,Mon,Tue,Wed,Thu,Fri,Sat};
              Integer     year=new     Integer(date.substring(0,4));
         return year.intValue();
    public static int getMonth(String date)     {
              //String date.substring(5,7);
              System.out.println(" "+date.substring(5,8));
              String     m= date.substring(5,8);
              int month=0;
              if(m.equalsIgnoreCase("Jan"))     {
              month=1;
              if(m.equalsIgnoreCase("Feb"))     {
              month=2;
              if(m.equalsIgnoreCase("Mar"))     {
              month=3;
              if(m.equalsIgnoreCase("Apr"))     {
              month=4;
              if(m.equalsIgnoreCase("May"))     {
              month=5;
              if(m.equalsIgnoreCase("Jun"))     {
              month=6;
              if(m.equalsIgnoreCase("Jul"))     {
              month=7;
              if(m.equalsIgnoreCase("Aug"))     {
              month=8;
              if(m.equalsIgnoreCase("Sep"))     {
              month=9;
              if(m.equalsIgnoreCase("Oct"))     {
              month=10;
              if(m.equalsIgnoreCase("Nov"))     {
              month=11;
              if(m.equalsIgnoreCase("Dec"))     {
              month=12;
              return month;
         public static int getDay(String date)     {
              Integer     day=new     Integer(date.substring(9,11));
         return day.intValue();
    public static int getNumberofSundays(String d1,String d2) throws Exception     {
              //d1 is leave start date d2 is leave end date
              // get object in Date form
                   Date date1=getDate(d1);
                   Date date2=getDate(d2);
              // now get calender objects from it
              GregorianCalendar c1= new GregorianCalendar(getYear(d1),getMonth(d1),getDay(d1));
              GregorianCalendar c2= new GregorianCalendar(getYear(d2),getMonth(d2),getDay(d2));
              // get period
              long leavePeriod = getDiffInDays(date1,date2);
         return 12; // it should return number of sundays but we type 12 to perform compilation
    public static void main(String[] arg)throws Exception     {
    System.out.println(" "+getNumberofSundays("2005-Oct-07","2006-Mar-01"));
    }

    thanks now i have modified the get Month Code
    as follows
    public static int getMonth(String date)     {
              //String date.substring(5,7);
              System.out.println(" "+date.substring(5,8));
              String     m= date.substring(5,8);
              int month=0;
              if(m.equalsIgnoreCase("Jan"))     {
              month=0;
              if(m.equalsIgnoreCase("Feb"))     {
              month=1;
              if(m.equalsIgnoreCase("Mar"))     {
              month=2;
              if(m.equalsIgnoreCase("Apr"))     {
              month=3;
              if(m.equalsIgnoreCase("May"))     {
              month=4;
              if(m.equalsIgnoreCase("Jun"))     {
              month=5;
              if(m.equalsIgnoreCase("Jul"))     {
              month=6;
              if(m.equalsIgnoreCase("Aug"))     {
              month=7;
              if(m.equalsIgnoreCase("Sep"))     {
              month=8;
              if(m.equalsIgnoreCase("Oct"))     {
              month=9;
              if(m.equalsIgnoreCase("Nov"))     {
              month=10;
              if(m.equalsIgnoreCase("Dec"))     {
              month=11;
              return month;
    but question remains same how to calculate number of Sundays Between 2 Dates

Maybe you are looking for

  • How can I open Internet Explorer from Forms?

    I could manage to open IE with HOST giving it the correct path from IE in my computer. But how can I find out what directory IE is? Should I use OLE2? If yes, then how do I use it? Thanks, Ariadne

  • ESS Webdynpro Java - Howto change the calendar

    Hello, i would like to change the shown calendar in the iview "Create new Travel Reqeust". it shows the last 4 months and finishes with the current month. This is not userfriendly, since a user who travels doesn't care about the last months. He is mo

  • Job Posting Data Overview Form

    Hi All, In my job posting process there data overview tab where we see a PDF form coming up with all the data of Job posting. I had to made changes to my standard smartform  by copying it(HRRCF_DATA_SUMMARY_POSTING) into custom (Z) smartform " ZHRRCF

  • Every time I open Firefox a program that has somehow attached itself to the browser opens and interferes with my searches.

    There is a program that has attached itself to my Firefox browser. Every time I open Firefox to search the internet this program is using pop-ups, to the extent that it completely interferes with my searches.

  • Need help from sspadafo!! Urgent

    Dear Scott, Am very new on using APEX & am working on a project to create a survey.. I was trying my best for the last week to build it but am facing too much problems & need really help in this to accomplish this project b4 the deadline, would you p