Need to calculate average

Hi all,
i have 2 int. tables defined as below:
DATA: BEGIN OF i_mgmt OCCURS 0,
       btrtl     TYPE pa0001-btrtl,
       btext     TYPE t001p-btext,
       perm      TYPE pad_amt7s ,
       con       TYPE pad_amt7s ,
       perm2     TYPE pad_amt7s ,
       con2      TYPE pad_amt7s ,
       perm3     TYPE pad_amt7s ,
       con3      TYPE pad_amt7s ,
       tot       TYPE pad_amt7s ,
       avg       TYPE pad_amt7s ,
      END OF i_mgmt,
      BEGIN OF i_mgmtavg OCCURS 0,
       btrtl    TYPE pa0001-btrtl,
       btext    TYPE t001p-btext,
       perm     TYPE pad_amt7s ,
       con      TYPE pad_amt7s ,
       perm2    TYPE pad_amt7s ,
       con2     TYPE pad_amt7s ,
       perm3    TYPE pad_amt7s ,
       con3     TYPE pad_amt7s ,
       tot      TYPE pad_amt7s ,
       avg      TYPE pad_amt7s ,
       avgsal   TYPE pad_amt7s ,
      END OF i_mgmtavg,
I need to calculate avgsal...
i_mgmtavg-avgsal = imgmtavg-avg / imgmt-avg.
I'm getting any idea how do calculate.please suggest some methods to calculate avgsal.
Thanks.

Hi Ramya,
You can try the following code
loop at i_mgmt .
read table i_mgmtavg with key btrtl = i_mgmt-btrtl btext-i_mgmt-btext.
if sy-subrc = 0.
i_mgmtavg-avgsal = imgmtavg-avg / imgmt-avg.
modify i_mgmtavg.
clear i_mgmtavg-avgsal.
endif.
endloop.
Regards,
Vik
Edited by: vikred on Jul 17, 2009 12:23 PM

Similar Messages

  • How to calculate average if some of measure values are 0

    Hi
    I created a webI report on top of a Bex query, I have a more than 10 different measure in WebI report column on which i need to calculate average.
    If I  use the Average function provided with in WebI report it is calculating average for the measures which are having 0  values too, but i need to calculate average on a column only for those values which are not 0
    Ex:  Measure Quantity has values in the report like
    100
    100
    0
    100
    100
    Average function is calculating as 400/5
    but I need 400/4, because one of the value is 0, so i need to avoid that count which is zero and should divide it by 4 but not 5.
    One way is to custom create measure for all measures and make a if else condition and divided by that custom measure, but is there any other procedure?

    i hope this can help
    =Average([myMeasure]) Where ([myMesyre] <> 0)
    good luck
    Amr
    before the 0 add <> not Equal too sign < and >
    Edited by: Amr Salem on Jan 19, 2011 9:29 AM
    Edited by: Amr Salem on Jan 19, 2011 9:30 AM

  • How to calculate average in result in BEx

    Hi Expert,
    I have 2 fields one is project and another # of days to finished project (I used formula to calculate the # of days from start to finished date. NOw in result need to calculate average of days took to finished all projects.
    I belive formula will be ( # of days / projects) but how we can apply in query. If anyone know please help out I really appericiate.

    Hi,
    Right click on your formula and go to properties, there you have the options as "Calculate Result as" and "calculate single value as" from the drop down box you can select option as "Average".
    Regards,
    Durgesh.

  • How do I calculate averages in a form?

    Hi All,
    I'm throwing myself on the mercy of the forum.
    I'm new to form building and I don't know javascript.
    I'm working on a form and I can't seem to get it right.
    When I first enter values it seems to be working, but if I make corrections or changes the calculations go bad.
    I'm sure there is an easier/better way to calculate averages in a form.
    I think I need either a calculate/re-calculate button, or better javascript that processes the math line by line.
    I'm getting too close to the deadline to keep futzing around with it.
    Would anyone care to have a look at my form and help me?
    Here are the details...
    I'm using Acrobat 9 Pro
    I, and the administrators, are using Adobe Reader X. (10.1.4)
    I'm using a Macintosh running OS X (10.7.4, Lion)
    Teacher Evaluation Form:
    Teachers demonstrate proficiency in four domains.
    Evaluators assign scores (-, N, 0, 1, 2, and 3) to a number of items in each domain.
    N indicates the item is Not Applicable.
    A dash - indicates a score hasn't been given yet.
    Each domain has a weight value to be calculated into the final score.
    My job is to create a form that calculates the raw average and the weighted score for each domain, then a total for the performance evaluation total.
    What I did.
    I created:
    A drop down field to score each item under each domain.
    A hidden field that decides if the field for each item has a true number or another character.
    A hidden field that sums the scores of all the items in each domain.
    A hidden field that sums the number of fields that have a numeric value.
    A field that divides the total of the values from each domain and divides it by the number of of fields with numeric values to get the raw average.
    A field that multiplies the raw average by the appropriate amount to get the weighted score for each domain.
    Finally, a field that sums the weighted scores to produce the final evaluation total.
    Again, it seems to work at first, but if any changes are made to the scores the math goes bad.
    Here is a download of the form with all the hidden fields visible so you can see what is happening.
    https://dl.dropbox.com/u/783012/2_Evaluation%20Form.pdf
    Please help me!

    There are several problems with the calculation script for the "Test Total" field. Be sure to have the following user preference set: Edit > Preferences > JavaScript > Show console on errors and messages.
    Also check that the field calculation order is correct.

  • Read-in CSV and Calculate Average Value

    I've got a csv file which I'm reading in but need to calculate the average value of the second column (CPU). It's in the following format:
    Date CPU
    01/09/2014 25.3
    02/09/2014 22.3
    03/09/2014 26.2
    04/09/2014 22.1
    I basically need the average CPU for the month. Any advice?
    Thanks in advance
    Adam

    "Date","CPU"
    "01/09/2014","25.3"
    "02/09/2014","22.3"
    "03/09/2014","26.2"
    "04/09/2014","22.1"
    '@ | sc test.csv
    (Import-Csv test.csv | measure CPU -Average).Average
    23.975
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Rule to Calculate Average

    I need help writing a rule to calculate average units. I know the HFM admin documentation contains an Average Function, but my calculation needs to be a little different. I need to dynamically calculate average units based on the POV. Also, I need to always use "Beginning Units" in my calculation. I've listed some examples below...
    1.) Periodic AvgUnits for May 2008 = (Apr 08 Units + May 08 Units) / 2
    2.) QTD AvgUnits for May 2008 = (Mar 08 Units + Apr 08 Units + May 08 Units) / 3
    3.) YTD AvgUnits for May 2008 = (Dec 07 Units + Jan 08 Units + Feb 08 Units + Mar 08 Units + Apr 08 Units + May 08 Units) / 6
    Does anyone have any sugestions?
    Thanks,
    Clint

    You need to use 3 different formulas here are some examples, you can derive the quarterly from this two:
    Function Avg2(Acct)
    Avg2 = "(" & Acct & " + " & Acct & ".P#Prior) / 2"
    End Function
    Function AccumYTD(Acct,pov_period)
    AccumYTD = "(" & Acct
    Select Case pov_period
    Case 1
    AccumYTD = AccumYTD & " ) "
    Case 2
    AccumYTD = AccumYTD & " + " & Acct & ".P#CUR-1 ) "
    Case else
    For PastMonth = 1 to pov_period - 1
    AccumYTD = AccumYTD & " + " & Acct & ".P#CUR-" & PastMonth
    Next ' PastMonth
    AccumYTD = AccumYTD & " ) "
    End Select ' Case pov_period
    End Function

  • Business Intelligence How to Calculate average of survey in a Deploy Cube to Display The Some of Yes and NO.

    I have created  and deploy this cube but needed to know how I can show the average of the survey result.
    Where I need to calculate the number of 'yes' and 'no' or even if possible "no answers" of every distinct survey question. My most Significant table is the" valuefield" who is  part of the fact table and has "yes" and "no"
    or null info. Am using MS Visual Studio and SQL SERVER Just a sample of 10 survey questions.
    ANY GEEK OUT THERE?

    Hi G33km,
    According to your description, you want to calculate the numbers of survey which is "YES" or "NO", right? In this case, create a calculated measure, in that measure using
    Filter function to return the set that results from filtering a specified set based on a search condition (in your scenario is that survey is "YES" or "NO"). And then use the
    Count function to return the numbers of survey.
    Besides, here is a blog about Optimizing Count(Filter(...)) expressions in MDX, please see:
    Optimizing Count(Filter(...)) expressions in MDX
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to calculates averages and send to a file?(source code)

    how to calculates averages and send to a file?(source code) I need to get started but I don't know where to begin...........the book I have doesn't really say how to handle averages and send to a file.................anybody got suggestions on how to get started? I am a newbie so place in layman's terms.............thanx

    To calculate an average: add all of the numbers together and divide by how many numbers you added together.
    ex: (1 + 2 + 3 + 10)/4 = 4 (4 is the average)
    As for writing them to a file, look over the API for random or sequential access files.

  • Can we calculate Average in VC

    Hi,
    Can we calculate average of all values of one data field itself, in VC.
    I had a keyfigure Quantity, now i need to display Avg of all Quantity according to calendar month.
    is this is possible in VC?
    Thanks
    Tulsi

    Hi
    yse you can do it using Aggreagate operator i.e Sigma Operator
    Drag the sigma operator from compose panel and it to the data service output port and set your settings
    Regards,
    Govindu

  • How to calculate Average balance for an account

    Hi,
    How to calculate average balance for an account for a particular period say for JAN-12 period and after the end of that period for another two days 01-feb-12 and 01-feb-12 ?
    I'm using the following query :
    SELECT cc.segment1||'-'||cc.segment2||'-'||cc.segment3||'-'||cc.segment4||'-'||cc.segment5||'-'||cc.segment6 "Account_XX",
    nvl(sum(l.accounted_dr - l.accounted_cr),0) "Balance"
    FROM gl_code_combinations cc,
    gl_je_lines l
    WHERE cc.code_combination_id = l.code_combination_id
    AND l.set_of_books_id ='XX'
    and code_combination_id = replace it with code combination_id for account_xx
    AND l.effective_date <= '31-Jan-12' (january period end ??)
    GROUP BY cc.segment1||'-'||cc.segment2||'-'||cc.segment3||'-'||cc.segment4||'-'||cc.segment5||'-'||cc.segment6
    There are some discrepancies in "average balance" after end of month (Jan-12)?
    How to calculate average balances for a particular account (Account_XX above)from end of month of Jan to first two days of february?
    Thanks,
    Kiran

    Kiran,
    Please let me know first, is Average Balancing feature enabled in your GL Ledger?
    Regards
    Muhammad Ayaz

  • Need to calculate subtotal and print it on basis of dc,store and lid number

    Hi Expert
    I need to calculate sub total for couple of fields on the basis of DC, store and lid number. I have clculated the sub total in query level but while printing it in the report i am facing the real problem.
    Please find the example:
    For DC=1111, store=2222, lid no=3333
    QTY rcvd qty ordered qty available REFNO
    20 300 680 7859
    45 258 348 4528
    For DC=1111, store=2222, lid no=3334
    QTY rcvd qty ordered qty available REFNO
    58 78 69 1487
    45 54 74 2578
    i want the sum in below of completion of one set of values. but as i am calculating the sum in sql query , i put it in a group and it is appearing in the end of every line which is not my desired.
    Kindly let me know how to do the grouping so that i can get it in the end of each combination of DC,store, lid no.
    Thanks in advance.
    Regards
    Srikant

    Can you send me the xml and RTF template to [email protected] ? I will take a look.
    Thanks,
    Bipuser

  • PDF Form Field calculates AVERAGE incorrectly

    I have a PDF Form field that is set to calculate the AVERAGE of 4 other fields. Each of those other fields has its validation set to allow only the values 1 through 3.
    The Average field is dividing the total by 4 even if a person only fills out 2 of the fields. I thought AVERAGE would only count the fields that have a value in them. But it's seeing the ones that are blank as containing a 0, even though that is an invalid value for that field.
    How can I fix this? The customer really wants the option of having up to 4 fields and wants an average of just the ones that are filled in. I thought that was what Average was supposed to do.
    Is there a way to tell Acrobat to ignore the fields if their value is less than 1?

    I responded to this question here: http://answers.acrobatusers.com/PDF-Form-Field-calculates-AVERAGE-incorrectly-q13211.aspx

  • "Calculate Average" option for the Activity Usage Profile doesn't work

    I have the same problem as poster 793128 in a comment for a different thread: the "calculate average" profile option doesn't work for units (it works for cost though). I've used this option a lot on previous versions of Primavera but for some reason is not working on our new P6 release 7 (stand alone). As 793128’s post says: nothing happens, nothing changes, the profile keep showing totals, doesn't matter if the "base hours on time period" box is selected or if the divider is input by the user.
    The same option (calculate average / divide by) on the resource usage spreadsheet and on the tabular reports do work as expected so doesn't seem to be that I checked the wrong box for some user or administrator preference set up.
    Thank you for any help or clue. I posted this as a different thread because my original post was in a resource profile thread for a different issue that was already answered.

    *793365,*
    After reading your post I tested an older layout of mine that uses a similar setup and it still operates fine. On the "Resource Usage Profile Options" box under the "Graph" tab, I have "Calculate Average" checked and "24" entered in the "Divide interval totals by:" box.
    This allows my resource profile to display manhours per day for me.
    Some of my background info:
    I run in a multi-users platform and not in a stand alone setup.
    We have different resources loaded into the schedule with multiple calendars.
    I have several "Resource Filter/Group Names" setup for each separate resource on the "Data" tab too.
    Hope this helps,

  • Need to calculate the area of a vector shape in Illustrator CS6

    Hi All,
    I need to calculate the area of vector graphics we are designing for a vinyl window sticker. I've read a couple of previous threads, and all the solutions provided either don't work (using cmd, option, shift F12 to open debugging menu to get area), or are beyond my level of experience (doing a build of the Telegraphics Path Area Filter). Does anyone have any solutions, or know how to access the debugging menu/window other than using cmd, shift, option F12....I couldn't even find it in the Shortcut Keys preferences).  Thanks!

    Jacob
    It worked very well - great stuff!. I am a physician and I am working on cardiac MRI.. such as calculating the heart function using slices of heart images in systole and diastole (when the heart is squeezed or full of blood).
    .. we can write a little medical paper comparing really pricey software (GE, Siemens, Medis you name it..) with this method for people with not too many pennies in their pocket. The advantage of using Illustrator is that you can blow up the images up to the point of loosing resolution, and trace the margins of the heart with an accuracy that would make any GE guy cry for his mama..
    I thought even a cm further.. for simple-minded people (such as physicians for example) one would like a way to input the area of one slice directly into an equation. For example would be a way to create a routine that would take the number of the area of one slice and input it in this equation? Such as to create a little square where you put the slice, you trace it and then the program takes that number and pitches it in the equation without you writing it down on a paper.
    thanks again!
    Avi

  • How to calculate Average time from a date field

    Hi All,
    I have a date type field in my table .
    I want to calculate average time for a given country in a select query. Date has to be exculded. Only time has to be taken into consideration.
    Kindly help me.
    Sample data
    india 25-JUN-09 08:12:45
    india 25-JUN-09 09:01:12

    Take which one you want.WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT TO_CHAR(to_date(AVG(to_number(TO_CHAR(to_date(TO_CHAR(x,'HH24:MI:SS'),'HH24:MI:SS'),'sssss'))),'sssss'),'hh24:mi:ss')
       FROM dates;
    WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT floor(24 * AVG(x- TRUNC(x)))
      || ':'
      || floor(mod(24 * AVG(x- TRUNC(x)),1) * 60)
      || ':'
      || floor(mod(mod(24 * AVG(x- TRUNC(x)),1) * 60,1) * 60)
       FROM dates;By
    Vamsi

Maybe you are looking for

  • Hard drive crash- cannot load burned cd's from ipod onto desktop

    I recently had a HD crash. replaced HD, downloaded Itunes. synced with Ipod, but only the "purchased music" was loaded onto the new desktop hd. I have hundreds of songs and audio books which I have burned from cd"s to itunes,  How do I get Itunes to

  • How to deploy .war file with Spring 2.5/Hibernate 3 into WebLogic 10.3.6

    Hey everyone, I tried to deploy a .war file, which is written in Spring 2.5/Hibernate 3/J2EE 1.4, into WebLogic 10.3.6. Failed. following are steps I did: install the war file via Install Application Assistant of webLogic console 1. select .war file

  • Difference between Mac and Windows Format

    Is there any differences between the two. I have a nano that is windows formatted, but it also works on my mac. Does it really matter which OS you use to format it?

  • Acrobat Pro 8 -Vs- Office 2007

    Hello, Here is my situation, I have Acrobat Pro 8 and Office 2007 installed. I can create PDF's from Office files no problem, I can combine PDF's no problem. I cannot simultaneously combine Office files and turn them into PDF's I get the following er

  • Aschere Energy, Dallas - Adobe Reader not working.

    Hi All, I am Erin Steward working in Aschere Energy, LLC in Dallas. I was using adobe reader from a couple of months and it was working fine. But now I am having problem in my adobe reader. I had updated it through the internet but now whenever I am