How to calculate Average

Hi,
I have a calc that is supposed to calculate the average but I dont know how to do it.
Time prompt: enabled to take X number of months.
$$: a certain amount of $$  corresponds to each month taken by the prompt
Example:  8 months (Jan to Aug), $100 each =  800 / 8 = 100
3 months (Jan to March), $100 each =  300 / 3 = 100
The final amount (average) has to be posted to all the months of the next year.
The issue is how to tell BPC the number by which the sum is going to be divided because it varies depending on the months taken.
Thanx, i'll post my script here.
I also have a prompt for the category (version) which may be Real, Budget, etc...
*SELECT(%vapi%,"id","conceptos","vap='i'")
*WHEN conceptos
*IS %vapi%
*WHEN metrica
*IS hojas_r,metros_r,precio_r
*WHEN tiempo
*IS %tiempo_set%
*WHEN versiones
*IS Real_2011
*FOR %anio%=2012
*FOR %mes%=ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic
*REC(expression= %value%, tiempo=%anio%.%mes%,versiones="esperado_2012")
*NEXT
*NEXT
*IS Real_2012
*FOR %anio%=2013
*FOR %mes%=ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic
*REC(expression= %value%, tiempo=%anio%.%mes%,versiones="esperado_2013")
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*COMMIT
Thanx
Velázquez

Hi Karthik,
Thanx for the reply, I changed the following:
PROMPT(RADIOBUTTON,%MESES%,"seleccionar meses a promediar",1,{"1 mes"," 2 meses"," 3 meses"," 5 meses"},{"1","2","3","5"})
TASK(Execute formulas,LOGICFILE,%APPPATH%..AdminApp%APP%TestAlldoraVentas2.lgf)
TASK(Execute formulas,FORMULASCRIPT,"*FUNCTION VIGENCIA=%MESES%")
(this one above is important)
I know that Run_Stored_Procedure is not supposed to coexist with WHEN/ENDWHEN structures... however, I still posted it in my script logic, therefore I got this error:
TOTAL STEPS  1
1. Execute formulas:      Failed  in 1 sec.
2. FX Restatement:        completed  in 1 sec.
CHECKLCK= No
MESES=5
(Member Selection)
TIEMPO: 2011.ENE,2011.FEB,2011.MAR
Execute formulasError
error running stored procedure PROMEDIO 5: Could not find stored procedure 'PROMEDIO'.
Please help me out...
I also tried adding %tiempo_set%  to the R_S_P but still doesnt work...
Script:
*SELECT(%vapi%,"id","conceptos","vap='i'")
*SELECT(%vapc%,"id","conceptos","vap='c'")
*SELECT(%vape%,"id","conceptos","vap='e'")
*SELECT(%toner%,"id","consumibles","tipo='T'")
*SELECT(%drum%,"id","consumibles","tipo='D'")
*SELECT(%fusor%,"id","consumibles","tipo='F'")
*SELECT(%otros%,"id","consumibles","tipo='O'")
*XDIM_MEMBERSET conceptos=%vapi%,%vapc%,%vape%
*XDIM_MEMBERSET consumibles=consumibles_dummy,%toner%,%fusor%,%drum%,%otros%
*XDIM_MEMBERSET lob=servicios_out
*XDIM_MEMBERSET metrica=precio_r,pieza_r,hojas_r,metros_r
*XDIM_MEMBERSET moneda=usd,mxn
*XDIM_MEMBERSET oi <> oi_dummy
*XDIM_MEMBERSET vendedor = 01,02,03,04,05
*RUN_STORED_PROCEDURE=promedio(VIGENCIA)
*COMMIT
*WHEN conceptos
*IS %vapi%
*WHEN metrica
*IS hojas_r,metros_r,precio_r
*WHEN tiempo
*IS %tiempo_set%
*WHEN versiones
*IS Real_2011
*FOR %anio%=2012
*FOR %mes%=ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic
*REC(expression= %value% / %meses%, tiempo=%anio%.%mes%,versiones="esperado_2012")
*NEXT
*NEXT
*IS Real_2012
*FOR %anio%=2013
*FOR %mes%=ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic
*REC(expression= %value%, tiempo=%anio%.%mes%,versiones="esperado_2013")
*NEXT
*NEXT
*IS Real_2013
*FOR %anio%=2014
*FOR %mes%=ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic
*REC(expression= %value%, tiempo=%anio%.%mes%,versiones="esperado_2014")
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*COMMIT
Thanx
Velázquez

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

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

  • 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 using Dimension Formulas  or Default Logic

    Hello
    I am trying to calculate the average without success. Do you know how I can Achieve the following? :
    We have multiple u201Cofficesu201D in the ENTITY dimension that fall under a Region. Let´s say 400+ offices under 20 Regions
    For example:
    Region1
       Office A
       Office B
    Region2
       Office C
       Office D
       Office E
    We have an Account named 'SalesUnits', and I am looking to get an Average Sales by Region and then be able to compare one Office against the Average of the REGION it belongs to.
    So If I have:
                                Sales Units
    Office C                   20
    Office D                   10
    Office E                   15
    Average of Region 2 would be 201015/3 =15
    But the number of office is variable, Sometimes I can have more offices.
    So I will have to count the number of offices that belongs to that region.
    I need this average so every office can compare their sales against the Region Average.
    Do you know how I can do this? I have tried some MDX syntax but without sucess.
    Thanks in advance!
    Anna

    Hi Anna,
      This will need to be done in Dimension logic as I assume, you;'d like to have the average up the region heirarchy.
    I'd suggest having 3 accounts for this
    ID .....................................FORMULA
    SALES_UNITS...................
    OFFICE_COUNT.................1
    UNITS_AVEREAGE............SALES_UNITS/OFFICE_COUNT
    The formula bit, goes in the formula column. When look at office count against the region heirarchy, it will sum up the 1's thereby giving you the denominator for the formula and you'll get the avereage up the region heirarchy.
    Tim

  • How to calculate Average value stock value - MC.B

    Hi All,
    When we execute T code MC.B  we get material analysis report . In it we have a column AVG VAL STOCK VALUE.
    Can some one explain how it is calculated. I see the formula
    The average stock value of the valuated stock is calculated using the formula:
             beginning stock value + n stock value at month´s end
                                    n + 1
    Can Some one explain how it is calculated and what 'N' stands for?
    Thanks,
    Vengal Rao.

    MC.B is inventory turnover.
    In the selection screen you enter how many periods to analyze.
    by default it is today 06/11 to 08/11
    n is the number of periods
    so you have a beginning stock of period 06/11
    + end stock of period 06/11
    + end stock of period 07/11
    + end stock of period 08/11 (which is todays stock)
    so the formula is:
    beginning stock value + 3 stock value at month´s end
    3 + 1

  • How to calculate Average Price

    Hi,
    having worked a lot with other analytic engines (mainly Microsoft Analysis Services) I am currently digging into SAP HANA and its Analytical Views. But I am already stuck at what I consider the most basic requirement - calculating an average like this:
    Sales
    Quantity
    Avg Price
    Product A
    1000
    10
    100
    =1000 / 10
    Product B
    2
    2
    1
    =5 / 1
    All Products
    1002
    12
    83,5
    =1002 / 12
    =1000 + 2
    =10 + 2
    So "Avg Price" is defined as "Sales"/"Quantity":
    How can I make the "Avg Price" for 'All Products' show the correct value as in the example above?
    at the moment it simply sums up 100 + 1 which is of course wrong as averages cannot be summed up ...
    I have found some "solutions" (I would not call it like that) here on the SAP HANA Developer Center which all rely on creating a second table with the same granularity as the main table but without e.g. products and use this to create averages, ratios, etc.
    see for example here: SAP HANA: Using "Dynamic Join" in Calculation View (Graphical)
    But this does of course not work anymore if i put e.g. Months or any other attribute (except Products)  on rows which renders the whole Analytical View useless for Ad-Hoc reporting
    maybe I just missed something (hope so)
    any feedback is highly appreciated!
    thanks,
    gerhard

    Hello Gerhard,
    for your specific example you can solve this by using a calculation view with an aggregation an a union node.
    Here a "quick and dirty" overview:
    What steps I did:
    Create a projection node which gets the data from the DB table.
    Create an aggregation node which gets all products from the previous projection node. The Sales and Quantity information is summarized over all products in that node. Via a "calculated" column I set the pseudo product name "All Products".
    Create a Union node which unions the not aggregated product information from the first projection and from the aggregation node. The pseudo "product name" is mapped to the product name column in the output.
    In the projection node (that one before the semantics node) I added the calculated column for the average price. So the average price is calculated for the not aggregated and the aggregated values.
    Here is the result:
    Of course if you need some additional attributes beside the product name, they still have to be added to the attribute list.
    Best regards,
    Florian

  • How to calculate average of step-shaped waveform?

    hello, i have analog waveform which looks like an incremental step function... the step increments in fixed time duration of 'x' sec, and stays at a near constant value, but has some noise
    (ex. attached image)
    i would like to find out the average of values in each step... 
    can anyone please suggest any algorithm?
    thanks,
    Now on LabVIEW 10.0 on Win7
    Attachments:
    Untitled.jpg ‏6 KB

    I did something like this in my Matlab days. I can give you a general idea on how I accomplished it.
    1) Take the derivative (or point by point subtraction) and scan that derivative for a positive threshold. This will be the first jump in voltage, or hopefully the start of the first step.
    2) Now, if you know the exact size of each step, you know the start/stop of each step. However, you likely want to only grab the center. If you get too close to the transition points, you scew your results. These centers can be calculated as Center Time = Start Time + Step Length* (N+1/ 2).
    3) Now that you have the center of your step. You want a percentage of the total step (again, don't want transitions). You can get the start and stop of an individual step. Start and stop times = Center Time +/- Percentage/2 * Step Time.
    4) Average the points between the times.
    Josh
    LabVIEW CLD
    Software is never really finished, it's just an acceptable level of broken

Maybe you are looking for

  • HP Photosmart C4599 - Only part of document scanned

    When I scan a document, sometimes only part of the page has been scanned when the HP Digital Scanning software displays the result of the scan. Other times the document scans ok and we can't work out why sometimes it works and other times it doesn't.

  • Error installing 11.5.9 on ENterprise linux 4.0

    Hi, I am trying to install 11.5.9 on ES Linux 4.0. I am getting the following error. Your help on this highly appreciated. Rgds Processing DriverFile = /Stage11i/startCD/Disk1/rapidwiz/template/adriapps.drv Running Instantiation Drivers for /Stage11i

  • Headless problems

    Hello, guys! I'm very tired of headless mode... I have to create image from JComponent (a big chart inside JPanel) at the server side. I've started with simple test progrmam: =========================== public static void makeTestImage() throws Excep

  • Syncing - what to select in itunes

    Hi, I need someone who can give a very specific answer in detail for this one... ....in order to do a sync, such that everything currently on my ipad gets backed up on my computer...photos notes emails apps music etc... ....and everything on itunes o

  • Making Photoshop - Help!

    Hi. I have created a mock layout on Photoshop. When I preview it in the browser  it doesn't fit in the browser correctly its not filling the page. How do I fix  this?