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

Similar Messages

  • 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

  • Calculate average for some dates

    Hi,
    I would like to calculate average for some dates. Is there any function module or any process, please provide me.
    venkat.

    Use this FM HR_HK_DIFF_BT_2_DATES
    Example:
    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.
    Regards,
    Joan

  • 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.

  • 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 to calculate averages and send to a file?(source code)

    Having trouble the book isn't very clear on how to use averages.............could some give me an example of a program..................that gets averages and send to a file..........?

    From Deitel and Deitels monster 'How to Program' :
    import javax.swing.JOptionPane;
    public class Average {
    public static void main ( String args[] )
    int total, gradeCounter, gradeValue, average;
    Swing grade;
    total = 0;
    gradeCounter = 1;
    while ( gradeCounter <= 10 ) {      //assuming 10 values
    grade = JOption.showInputDialog ( "Enter grade: " ) ;
    gradeValue = Integer.parseInt ( grade );
    total += gradeValue;
    gradeCounter = gradeCounter + 1;
    average = total / 10;
    JOptionPane.showMessageDialog (
    null, "Class Average is" + average, "Class Average",
    JOptionPane.INFORMATIOIN_MESSAGE );
    System.exit ( 0 );
    Import package java.io
    Three stream objects are created when you execute , System.in, System.out, System.err
    System.out can be directed to send it's output to a file or disk.

  • 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

  • How to calculate average not through basic formula

    Can any bodytell me how to calculate averge of 96 rows in the quey designer  not by hard coding them.
    Is there any formula for creating it through formula or through calculations .
    And also how to calculate the maximum value and minimum value of the entire 96 rows  which is picking from a Z table -ZDC_2100.
    Iam having time blocks of 96 for 24 hrs each of  15Min.

    Hi,
    You can achieve using a counter at baselevel and use exception aggregation at query level...
    Also check the below links might be useful:
    http://help.sap.com/saphelp_nw04/helpdata/en/75/21054da1392649948e5b94e4fc4bce/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/e0173f5ff48443e10000000a114084/frameset.htm
    Hope this helps.......
    Rgs,
    I.Ravikanth

  • How to calculate Average of Keyfigure

    Hi Gurus,
    I have a requirement where I have to calculate average of key figure value for 1 material.
    I tried using 'Average' in exception Aggregation but it just sums up everything.
    Can anyone please explain?
    Thanks

    Hi
    1. Include the key figure you want to average into the columns; call it KF1
    2. Create a Formula; call it CTR1, and in the detail view put a 1. (This 1-value is not used except to avoid an error in the formula syntax checker.) On the Aggregation tab, choose Exception Aggregation: Counter for all Detailed Values, and for the Ref. Characteristic, choose the same characteristic as the lowest level characteristic in the initial view of the output. E.g. if you only have 0CALMONTH in the output, choose 0CALMONTH. When you run this, the total at the bottom of this column should be equal to the number of rows in that column. Note that we use Exception Aggregation here so that the total at the bottom is calculated before the output is generated and is available to other formulas in the query design; if we were to use the Calculation tab it would look the same to us in that the total would appear at the bottom, but the calculation would occur too late for us to use within the query.
    3. Create a second formula, call it AVG1. The formula will be:
    SUMGT KF1 / SUMGT CTR1
    SUMGT accesses the Overall Result value at the bottom of the KF1 and CTR1 columns. You can find the SUMGT function in the Data Functions folder - turn on technical names first; the description is Overall Result. You could instead use SUMRT; the difference is that SUMGT will use the filters applied in the filter block; SUMRT will ignore them.
    3. Run the query. You should see the Average in every cell in the Average column. You can use this formula as input to another formula, or just use ( SUMGT KF1 / SUMGT CTR1 ) within a formula to access the average value.
    Thanks

  • How to calculate percentage and difference of two values in matrix report in ssrs 2008

    Hi everyone,
    DB--SQL server
    SSRS-2008
    I am creating matrix report with grouping on WEEK and Fiscalyearweek,
    I need to calculate of difference between FY14W01,FY15W01 ande  percentage of those..
    how to calculate in ssrs level.
    Thank You, Manasa.V

    Hi veerapaneni,
    According to your description, you want to calculated the increment percentage and difference between two fiscal year week within each week. Right?
    In this scenario, since we need to do calculation based on values between dynamically generated cells, we can't simply use expression to achieve this goal. In this scenario, we need to use custom code to record the value for fiscal 14 and fiscal 15, then
    we can calculate the difference and percentage within the column group. We have tested your case in our local environment, please refer to the steps and screenshots below:
    1. Add the custom code below into the report (you may need to modify the data type based on your scenario:
    Public Shared Value1 as Integer
    Public Shared Value2 as Integer
    Public Shared previous as string
    Public Shared previousweek as string
      Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
    If product =previous and Week =previousweek  Then
         Value2=Value
    Else
    previous=product
    previousweek=Week
    Value1=Value
    End If
         return Value
      End Function
      Public Shared Function GetPct()
         return (Value2-Value1)/Value1
      End Function
    Public Shared Function GetDiff()
         return Value2-Value1
      End Function
    2. Design the matrix like below:
    3. The result look like below:
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to calculate the difference of two totals which are of the same group?

    Post Author: mingli
    CA Forum: Formula
    Hello,
    I have an existing report which has a group defined. The group generates two set of data, at the footer of each set of data, the total is calcuated. Now I need to calculate the difference between the totals. For example:
                             value
    set 1
          item 1         100
          item 2         200
          item 3        300
    set 1 total         600
    set 2
         item 1         200
         item 2          20
         item 3        300
         item 4         40
    set 2 total       560
    difference       40
    My question is: how can I do this? I'm thinking about create a formula. But the problem is, these two totals have the same field name. Could someone help me out?
    Thanks.

    Post Author: deejayw
    CA Forum: Formula
    Hi,I have a similar type of query...my Sets only ever contain two entries but there is an unknown number of sets.                        value
    set 1
          item 1         100
          item 2         200
    difference (item2 - item1) =   100
    set 2
         item 1         200
         item 2          20difference (item2 - item1) =    -180
    Set 3, Set 4, etc, etc I need to figure out how to calculate the "difference (item2 - item1)" total above. I am really confused by this and need assistance. Many thanks. 

  • How to disappear the sub Report if the values are null from db..

    hi.
    i have one requirement ie.
    i put two sub reports at report footer section..
    sub report values are coming from the data base
    Some times  there is no values in data base at sub report two
    plz have a look on below image..it becomes empty.
    can i disappear the sub report if there is no values..
    I need your valuable suggestions..

    Hi
    In your sub reports, you also have to suppress the values (report labels,headings etc) using a formula.
    Go in Report Menu--Section Expert--Suppress -- Formula editor and write the follwoing :
    if Count({Yoursubreportfield)}) > 0 then false else true
    This will suppress your headers and footers or any other secitons which has static information.
    Now in the main report go in section expert and check 'Suppress Blank Sections'
    Also check you have applied New Page before or After for any of your sections.
    --Praveen G

  • Measures values are twice as big compare to corresponding fact table

    The version used is SQL Server 2012
    We have a CustomerAddressKey in fact tables with many partitions and Regular Dimension Usage between fact table and CustomerAddress dimension. As we do not process all partitions every day sometimes we encounter the issue when users see the old address for
    a particular player.
    We have played with 2 approaches: Referenced Dimension Usage and modification of CustomerAddress view when only current (latest) address is available.
    After we build and process Referenced Dimension Usage version using CustomerAddress as Reference Dimension  and Customer as Intermediate dimension and CustomerAddressKey and CurrentCustomerAddressKey.
    Everything is OK besides that the measures value for any slice is twice as big as corresponding fact table value.
    What did we do wrong?
    serguei russky

    There are a couple of ways that data can get duplicated in SSAS
    One is incorrectly running multiple ProcessAdd operations. ProcessAdd always appends data. So if you run it twice with the same set of rows you end up with duplicate fact rows in your cube. The way to fix this is to run a ProcessFull on the affected partition/s.
    The other common thing that can duplicate data is issues with your data and / or schema. The following is just psuedo code, the join conditions should be the same as you've specified in your DSV. If you run these two styles of SQL queries over your raw data
    and they return different amounts then you probably have a problem with the way you have populated the data in your reference dimension table.
    SELECT SUM( <measure column> )
    FROM <fact table>
    SELECT SUM( <measure column> )
    FROM <fact table>
    INNER JOIN <reference dim>
    ON ...
    INNER JOIN <CustomerAddress dimesion>
    ON ...
    http://darren.gosbell.com - please mark correct answers

  • 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 calculate average value?

    Hi all,
    I'm using Lumira 1.15. I'm doing some practices with the sample dataset BestRunCorp... I want to calculate the average value of gross margin which is grouped by lines so that I can use a line chart to show the difference between the gross margin value and average value.
    How can I achieve this ?
    Best regards,
    Shuang

    It looks like it calculates the average based on the dimension
    See below:
    If you take the "Best run" Excel file, sort by country, calculate the average in Excel, it matches Lumira's 4,056 (for Argentina)
    I am not sure I follow your divide by 12 logic?

Maybe you are looking for

  • IPhone 3GS wont turn on and is not recognised by iTunes

    Okay, so my iphone is not working at all, i have tried everything possible. It will not turn on, itunes recognises it sometime for 30 seconds then it thinks i have not plugged anything in. I have tried DFU, recovery mode, checked the wires, updated i

  • Sort order from NAT rules via CLI

    Hi all, im a newbie here and i have my first question. Hope you can help me to find a solution. Is there a way to change the order of NAT statements via CLI in Cisco ASA IOS 9.1 ? By ASDM i can change the order and bring them up and down to the place

  • I just spoke to Apple rep about the Prepared To Ship

    Even if your phone does not say prepared to ship but your Delivery say Delivered June 24, you are getting your phone June 24. ABSOLUTELY GETTING IT THAT DAY! Your status will update when it ships even if they expedite your shipping. I only asked abou

  • Can't add actionscript to buttons

    Hi, I am currently trying to make a game in AS3 with forward and back buttons. I have drawn my buttons and converted them to symbol (button), but when I select the button and press F9 to add in the actions, this happens meaning I cannot add the scrip

  • IWeb not supporting enhanced audio podcasts

    I I have dropped an enhanced audio podcast onto an iWeb podcast template page and while it plays and shows the graphics in the podcast on the unpublished page, the interactive links embedded in the podcast don't work. Any ideas as to why this is? The