Totalling Averages
Hi,
I have a column of averages in a report. I need to total them, which
obviously means taking the average of all the averages, not just totalling the
averages. I am using a pivot table. Even when I set the 'Average' on the column within
the Pivot table view:
Column -> More Options -> Aggregation Rule -> Average
it doesn't seem to be totalling the averages correctly on the totals line.
Is there anything for the totals line itself, which is doing other totals on the
same line which aren't averages, I should be doing so get the average total column to
calculate properly.
Thanks for any ideas.
- Alan.
Duplicate question:
Totalling Averages
Alan please close this one so people only reply in one place.
Similar Messages
-
Hi,
I am using SSRS 2008 R2. I have a report to show the average value of branch wise sales, which i am implementing the following expression
=Avg(Fields!YTD_Total_Premium.Value,"Branch_Name")
Similarly I have to get the total average value of all these branches. As I am not calculating the average in query, please help me how to get the total average value of text box.This the requirement of my user. As I have shown in the textbox2 (from top) , I had calculated the average in the report instead of getting it from the query. To get the total
average branch wise I am getting error as we cannot use aggregate in an aggregate function in ssrs 2008 and below. Please help me to find the entire total at the footer too.
Row groups - Region, Continent
Column group - <sales Region Name>
Thank you,
Anu Ashokan.
Did you try below for total expression
AVG(Fields!YTD_Amount.Value,"DatasetName")
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
In OBIEE Report Grand Total instead of Average(Average) use Sum(Avg)?
Hi All,
In OBIEE Report Grand Total average always shows Average of average (Default) "avg(avg)" , can i overwrite this functionality to sum of average "sum(avg)".
Thanks in advance
Regards
KandasamyHello,
You can try the following:
Remove the calculate result as setting for the three KFs.
In exception aggregation set property to average with ref char as leave start date.
Check if it works.
If the above dosent work, set reference char to emplyee ID and check.
Either one of them has to work
REgards,
Shashank
Edited by: Shashank Dighe on Apr 2, 2009 9:03 AM -
How can I create a view of top five teams averages based on individual averages of that team?
I have created a list that groups teams by their Team name (Team column) with the individuals members (participants column) averages and their team average (total average view option). I want to only display the top five teams that have the overall
top team averages. I have a list that contains a team name, average minutes, week, and participant. The team manager plugs in each week a new entry for each participant on the team. I have a view that computes each team average but I want a view
of the top five teams based on the top averages of the team (not individual participant average). Unfortunately, I can only seem to get all teams grouped with individuals of that team, their individual averages and the team average but can't figure out
only how to show the top five teams top average. Because it's a total (team average) and not a separate column, I can't get a view by team based on total average. I can by top individual average but not by the team. Can some one help me figure
out a solution?A calculated column won't work because a calculated column can only reference the individual item, not the entire list or a subset.
You could do javascript to build this, but to me it's easier to just use Excel.
Andy Wessendorf | Solution Foundry [email protected] -
Lack of variability in report total in analysis
First off, sorry if this is a repetitious post.
But, when creating new applications and building analysis into them at startup, I have found that Oracle adds a row at the bottom titled "report total". The problem is that all this does is add the total of the column. In one case I had a series of averages in my column and would preferred to have a total average at the bottom or no information at all, not a sum of all the averages. I was wondering if there is a way to customize this or even turn it off?If none of the columns on the Reports Attributes page have a checkbox in the Sum column the 'report total' line does not appear.
-
BEx Query Formating - Displaying both Sum and Average in the same report
Hi everybody,
I need to create a BW report in the below format,
Company Code Total Total Average
0001 0002 0003 0004
Doc Type
AV 10 10 10 10 40 10
RV 20 20 20 20 80 20
Getting the report till the 'Total' column is easy but having the 'Total Average' as a separate column is where I am stuck.
Having the company code in the rows, and not clolumns, would have solved the issue but I need to keep the above format. Also I do not want to
see the Total Average for every Company Code, just that of the 'Total'.
In the Query Designer, in the Column section I have first the 'Company Code' and then the 'Count' in a structure, so whatever I add to this structure,
is displayed for each Company Code, that means 2 columns for each Company code. This changes the format.
I cannot use the Cell Definition method here, as then it would be a static structure and the number of Company Codes are not fixed.
It would be great if somebody could provide some suggestions.
Thank you,
AjayHi Suman,
Thanks for the quick reply.
I have tried this, but again this will change the format. With the way you said, I will only get the report in the below 2 formats,
1. Company code in Free Charac, later drill down to Rows,
Doc Type Company Code
AV 0001 10
AV 0002 10
AV 0003 10
AV 0004 10
Total 40
RV 0001 20
RV 0002 20
RV 0003 20
RV 0004 20
Total 80
or 2. Company code in Free Charac, later drill down to Column,
Company Code
0001 0002 0003 0004
Total Total Avg Total Total Avg Total Total Avg Total Total Avg
Doc Type
AV 10 10 10 10 10 10 10 10
RV 20 20 20 20 20 20 20 20
Both the above are different from the format that I need. -
Hi All,
I have the following requirement in ALV grid display- thru ALV FMs (not using OO ALV)
Inv no Inv type amount
1 A 6
3 A 8
Total average for for A is 14 (14/2)
2 B 6
9 B 3
8 B 4
10 B 7
Total average for for B is 5 (20/4)
Here after every Invoice type i need to calculate average and display with my own text as explained above.
I have searched many sites and tried but not able to get it..
Request you to please help if u have any idea on it.
Thanks.
Regards,
Lokesh*& Report Z_ALV_SUBTOTAL
REPORT z_alv_subtotal.&----
*& Table declaration
&----TABLES: ekko.&----
*& Type pool declaration
TYPE-POOLS: slis. " Type pool for ALV&----
*& Selection screen
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.&----
*& Type declaration
&----* Type declaration for internal table to store EKPO data
TYPES: BEGIN OF x_data,
ebeln TYPE char30, " Document no.
ebelp TYPE ebelp, " Item no
matnr TYPE matnr, " Material no
matnr1 TYPE matnr, " Material no
werks TYPE werks_d, " Plant
werks1 TYPE werks_d, " Plant
ntgew TYPE entge, " Net weight
gewe TYPE egewe, " Unit of weight
END OF x_data.&----
*& Internal table declaration
DATA:* Internal table to store EKPO data
i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
Internal table for storing field catalog information
i_fieldcat TYPE slis_t_fieldcat_alv,
Internal table for Top of Page info. in ALV Display
i_alv_top_of_page TYPE slis_t_listheader,
Internal table for ALV Display events
i_events TYPE slis_t_event,
Internal table for storing ALV sort information
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.&----
*& Work area declaration
&----DATA:
wa_ekko TYPE x_data,
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.&----
*& Constant declaration
&----CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.&----
*& Start-of-selection event
&----START-OF-SELECTION.* Select data from ekpo
SELECT ebeln " Doc no
ebelp " Item
matnr " Material
matnr " Material
werks " Plant
werks " Plant
ntgew " Quantity
gewei " Unit
FROM ekpo
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln
AND ntgew NE '0.00'. IF sy-subrc = 0.
SORT i_ekpo BY ebeln ebelp matnr .
ENDIF.* To build the Page header
PERFORM sub_build_header.* To prepare field catalog
PERFORM sub_field_catalog.* Perform to populate the layout structure
PERFORM sub_populate_layout.* Perform to populate the sort table.
PERFORM sub_populate_sort.* Perform to populate ALV event
PERFORM sub_get_event.END-OF-SELECTION.* Perform to display ALV report
PERFORM sub_alv_report_display.
*& Form sub_build_header
To build the header
No Parameter
FORM sub_build_header .* Local data declaration
DATA: l_system TYPE char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " Title
Title Display
l_r_line-typ = c_header. " header
l_title = 'Test report'(001).
l_r_line-info = l_title.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR l_r_line.* Run date Display
CLEAR l_date.
l_r_line-typ = c_item. " Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(002).
l_r_line-info = l_date.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR: l_r_line,
l_date.ENDFORM. " sub_build_header
*& Form sub_field_catalog
Build Field Catalog
No Parameter
FORM sub_field_catalog .* Build Field Catalog
PERFORM sub_fill_alv_field_catalog USING: '01' '01' 'EBELN' 'I_EKPO' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ', '01' '02' 'EBELP' 'I_EKPO' 'L'
'Item No'(004) 'X' 'X' ' ' ' ', '01' '03' 'MATNR' 'I_EKPO' 'L'
'Material No'(005) 'X' 'X' ' ' ' ', '01' '03' 'MATNR1' 'I_EKPO' 'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'WERKS' 'I_EKPO' 'L'
'Plant'(006) 'X' 'X' ' ' ' ', '01' '04' 'WERKS1' 'I_EKPO' 'L'
'Plant'(006) ' ' ' ' ' ' ' ', '01' '05' 'NTGEW' 'I_EKPO' 'R'
'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM. " sub_field_catalog&----
*& Form sub_fill_alv_field_catalog
*& For building Field Catalog
*& p_rowpos Row position
*& p_colpos Col position
*& p_fldnam Fldname
*& p_tabnam Tabname
*& p_justif Justification
*& p_seltext Seltext
*& p_out no out
*& p_tech Technical field
*& p_qfield Quantity field
*& p_qtab Quantity table
FORM sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.* Local declaration for field catalog
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv. wa_lfl_fcat-row_pos = p_rowpos. "Row
wa_lfl_fcat-col_pos = p_colpos. "Column
wa_lfl_fcat-fieldname = p_fldnam. "Field Name
wa_lfl_fcat-tabname = p_tabnam. "Internal Table Name
wa_lfl_fcat-just = p_justif. "Screen Justified
wa_lfl_fcat-seltext_l = p_seltext. "Field Text
wa_lfl_fcat-no_out = p_out. "No output
wa_lfl_fcat-tech = p_tech. "Technical field
wa_lfl_fcat-qfieldname = p_qfield. "Quantity unit
wa_lfl_fcat-qtabname = p_qtab . "Quantity table IF p_fldnam = 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
ENDFORM. " sub_fill_alv_field_catalog&----
*& Form sub_populate_layout
Populate ALV layout
No Parameter
FORM sub_populate_layout . CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'." Optimization of Col widthENDFORM. " sub_populate_layout&----
*& Form sub_populate_sort
Populate ALV sort table
No Parameter
FORM sub_populate_sort .* Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.* Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
ENDFORM. " sub_populate_sort&----
*& Form sub_get_event
Get ALV grid event and pass the form name to subtotal_text
event
No Parameter
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
'SUBTOTAL_TEXT'. DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.* Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.ENDFORM. " sub_get_event&----
*& Form sub_alv_report_display
For ALV Report Display
No Parameter
FORM sub_alv_report_display .
DATA: l_repid TYPE syrepid .
l_repid = sy-repid .* This function module for displaying the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in ALV report display'(055).
ENDIF.ENDFORM. " sub_alv_report_display&----
FORM sub_alv_top_of_page
Call ALV top of page
No parameter
----FORM sub_alv_top_of_page. "#EC CALLED* To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_alv_top_of_page.
ENDFORM. "alv_top_of_page&----
*& Form subtotal_text
Build subtotal text
P_total Total
p_subtot_text Subtotal text info
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
Material level sub total
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal
= 'Material level total'(009).
ENDIF.* Plant level sub total
IF p_subtot_text-criteria = 'WERKS'.
p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
ENDIF.
ENDFORM. "subtotal_text -
Discoverer plus running totals
hi,
any help will be appreciated.
I use Oracle discoverer plus. recently I tried to build a running total (average) calculation using the template provided. I defined 10 previous observations for this purpose. discoverer performed the calculation but the problem is with the first 9 (in this case) observations of the new calculation, because it averaged the first first observation, than the first two, than the first three and so on. when you get to the tenth observation it becomes correct, but you can imagine it is problematic, especially the graphic presentation. if I could present the graph only from the tenth observation and on it would be an acceptable compromise. any other suggestions are welcome too.
Thanks.
Mark.Hi,
I am afraid it is not at all clear what you are trying to do here. If you think of your results as a table of data do you want your calculation to be the same for all rows, a group of rows, or a running calculation changing for each row. Any graphical representation must be based on this underlying data.
Rod West -
Post Author: jehanzeb
CA Forum: Crystal Reports
Hello all,
I am wondering how can you get a grand total of "Average". I have a field in the report with Average per day per lense. Now at the end of the report I would like to show the grand total of all those averages.
Example:
Average Per day
2.00
3.00
1.50
At the end of the page (footer) it should show grand total of 6.50.
How can I achive this?
Help pleaseeee
I have tried sum, count, distrnt count etc but none seems to be working (tried the summary function key as well).
Regards
JehanzebPost Author: jehanzeb
CA Forum: Crystal Reports
Morning Khalil,
Firstly thanks for the kind reply. I have tried your explained method but unfortunately it didn't work, infact it has changed the values to 1.00 all the way.
Example -
Whileprintingrecords;Global Numbervar FAvg:=0; ( This stayed at it is and has been inserted onto the header - upon initialisation it is shown as 0 which is fine).
Whileprintingrecords;Numbervar FAvg;FAvg := FAvg+ {lab_rework.rework_qty}; ( The rework qty is the field which needs to be averaged - example from 01/05/2008 to 02/05/2008 there were 3 lenses which were reworked, so the average should be 1.5 per lense per day. However, using your formula it shows 1.00)
Whileprintingrecords;Numbervar FAvg; (This is the grand total of whatever the average field shows however this is showing 1.00 as well even though the records are showing 1.00, in theory this should add up all those 1.00s and should show 10.00 which it isnt.)
I have tried using the built in average running total but it doesnt seem to work as it calculates the average of the first day and not all days. For example when I entered the date range from 01/05/2008 to 02/05/2008, it shows the average of the 01/05/08 day and not the total average of both days hence showing only 1.00 as it calculating only one day. This however should calculate the average of the days I enterd into the parameters i.e. according to the date range
how can I achive the expected results (where it shows the average of all the lenses reworked according to the date range)?
Many thanks
Regards
Jehanzeb -
I need to be able to calculate the average difference between a total average on a single row for example
Value , AverageTotValue , Difference
2, 4, -2
4, 4, 0
6, 4, +2
preferably using Discoverer plus (although I could write a function if necessary)
Can anyone help ?Hi , your query as you provided it , returns just one row , whereas mine returns three rows...so , i convert it to the following:
SQL> select value , avg_total , value-avg_total diff
2 from
3 (
4 select value , (select sum(value)/count(value)
5 from
6 (select 2 as value from dual
7 union all
8 select 4 as value from dual
9 union all
10 select 6 as value from dual)) avg_total
11 from (select 2 as value from dual
12 union all
13 select 4 as value from dual
14 union all
15 select 6 as value from dual)
16 )
17 /
VALUE AVG_TOTAL DIFF
2 4 -2
4 4 0
6 4 2[pre]
Now , as regards , the sql statistics...
Mine
[pre]SQL> with sample_data as (select 2 as value from dual
2 union all
3 select 4 as value from dual
4 union all
5 select 6 as value from dual )
6 select value , avg_total , value-avg_total diff
7 from
8 (
9 select value , (select sum(value)/count(value) avg_total from sample_data) avg_total
10 from sample_data
11 );
Ðñüãñáììá åêôÝëåóçò
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=8 Card=3 Bytes=48)
1 0 TEMP TABLE TRANSFORMATION
2 1 LOAD AS SELECT
3 2 UNION-ALL
4 3 FAST DUAL (Cost=2 Card=1)
5 3 FAST DUAL (Cost=2 Card=1)
6 3 FAST DUAL (Cost=2 Card=1)
7 1 VIEW (Cost=2 Card=3 Bytes=48)
8 7 VIEW (Cost=2 Card=3 Bytes=9)
9 8 TABLE ACCESS (FULL) OF 'SYS_TEMP_0FD9D6608_7E7090' (
TABLE (TEMP)) (Cost=2 Card=3 Bytes=39)
ÓôáôéóôéêÜ
2 recursive calls
8 db block gets
9 consistent gets
1 physical reads
604 redo size
598 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
Yours
SQL> select value , avg_total , value-avg_total diff
2 from
3 (
4 select value , (select sum(value)/count(value)
5 from
6 (select 2 as value from dual
7 union all
8 select 4 as value from dual
9 union all
10 select 6 as value from dual)) avg_total
11 from (select 2 as value from dual
12 union all
13 select 4 as value from dual
14 union all
15 select 6 as value from dual)
16 );
Ðñüãñáììá åêôÝëåóçò
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=3 Bytes=48)
1 0 VIEW (Cost=6 Card=3 Bytes=48)
2 1 VIEW (Cost=6 Card=3 Bytes=9)
3 2 UNION-ALL
4 3 FAST DUAL (Cost=2 Card=1)
5 3 FAST DUAL (Cost=2 Card=1)
6 3 FAST DUAL (Cost=2 Card=1)
ÓôáôéóôéêÜ
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
598 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processedCoclusion: Yours is much less costly to system and so quicker.....
I have to confess that i have not thought this format ........I have learned something today....!!!!!!
I have get accustomed to using the with clause... but i may reconsider it....!!!!!!
Thanks , a lot for your valuable remarks....(as always)...!!!!
Simon -
By which transaction(standard report) we can get average moving value of the material on that day with the total average stock & total no of issue & reciept?
Urgent please
Regards
Inderhi,
<b>for stocks</b>
in mm03-----> in plant stock view u will find all details reagrding teh stock
eg;
Unrestricted stock, returns, blocked etc
also try storage location view
regards,
Arunprasad -
Average of values in variable ranges
Post Author: Graybane
CA Forum: Charts and Graphs
I am trying to generate a trend values that use variable ranges. For instance, I want a 12 month trend developed from preceeding 1 year + 1 month average, then preceeding year + 2 months average, then preceeding year + 3 months average and so on. I only want the values for the report for the 12 monthly values. This is all complicated by being a group function. Basically I am looking at priorities for requests in a single field and developing how long it takes to resolve the request based on another field which is what is used to develoe the averages for the trend. I have tried several methods and never gotten a good trend. The total average is correct if I do not do any weighting. Has anyone had any success with this? Are there any examples I can look at. Does anyone have any recommendations? Thanks for any helpI'm not entirely following you, Visakh, but I have a SQL Task setup in which I have an expression that makes a call to a db2 database such as the abbreviated set example below. The list of IDs in the IN statement must come from another SQL Server
database. In the past I have gotten the list of IDs, put them in a recordset and then put that in a for loop to iterate and make one call to db2 for each and every ID. The single ID example can literally take days to run for 100,000 IDs.
Therefore, I want to pull the entire set of results back at one time via a single (or at least fewer calls than there are IDs) DB2 call using 'in' instead. Maybe I am overlooking something but I don't quite see how your example will get me where
I want to go.
Set Example
SELECT
A,
B
FROM
Table 1,
Table 2,
WHERE
Joins
AND PRSNEUP.ID in ( This is where I want a list of IDs )
Single ID Example
SELECT A,
B
FROM
Table 1, Table 2,
WHERE
Joins AND PRSNEUP.ID = ( VariableContainingASingleID -
How to total all inputs after looping?
Hello, new user here. I've just started doing loops, but am have a little problem that I hope you can help me with.
I want to loop a program to input the commission figures for ten people, then calculate and output the total commission overall, as well as the average commission too.
I currently have the below code. But I do not know how to store one input somewhere, and then store the second input, etc, and then add these inputs together at the end. Any help is greatly appreciated! Thank you =)
import java.util.Scanner;
/* This program calculates total pay earned for five workers */
class Payslips
public static void main (String[]args)
Scanner input = new Scanner(System.in);
int x;
double commission, total, average;
for (x = 1; x <=10; x++) //will loop up to 10 times
System.out.println ("Input commission"); //outputs text
commission = input.nextDouble();
}Azzy22188 wrote:
Hello, new user here. I've just started doing loops, but am have a little problem that I hope you can help me with.
I want to loop a program to input the commission figures for ten people, then calculate and output the total commission overall, as well as the average commission too.
I currently have the below code. But I do not know how to store one input somewhere, and then store the second input, etc, and then add these inputs together at the end. Any help is greatly appreciated! Thank you =)
import java.util.Scanner;
/* This program calculates total pay earned for five workers */
class Payslips
public static void main (String[]args)
Scanner input = new Scanner(System.in);
int x;
double commission, total, average;
for (x = 1; x <=10; x++) //will loop up to 10 times
System.out.println ("Input commission"); //outputs text
commission = input.nextDouble();
initialize toal to zero
inside the loop , add commision to total.
Once the loop is over , you have the total value in the variable 'total'.
Divide total by the number of times looped to get the avg. -
CPIC/RFC Time vs Total Response time
Hi experts,
We are experiencing performance issues in our SRM system, when checking the transaction ST03 we have identified a high dialog comsuption time in the Average RFC Interface time (CPIC/RFC), this time is even higher than the Total Average Reponse Time per dialog step.
Could you please let us know if the component Average RFC Interface time (CPIC/RFC) is part of the average response time? We can't understand why this time is almos the double than the
Thanks and best regards,Hello Sowmya,
I would normally suggest a solution without having detailed background about your system such as SAP kernel, SAP release etc.
But the following SAP Note almost describes your issue.
2071875 - Incorrect Average RFC Interface Time ("CPIC/RFC") in ST03N Workload Overview ("Average time per step in ms")
Hope that helps.
Regards,
Siddhesh -
Can i add an if statement anywhere in this code?
I need to add an if statement anywhere in this code, it doesnt matter where, but if it is nested it would be better. any ideas?
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.util.*;
import static java.lang.System.out;
import java.util.Scanner;
//Defines the counter for the student count and the lists for students
//to be saved in
public class EdronProject {
private int studentCount;
private static final String USAGE = "Usage: java EdronProject <student count>";
private List<Student> list;
//Set up the counter fo the number of students and the list in which
//each student's information is saved once processed
public EdronProject(int count) {
studentCount = count;
list = new ArrayList<Student>();
//Checks the number or arguments, and it executes the rest of the code
//if there is 1 argument or more (the number of arguments = the number
//of students being processed)
public static void main( String args[] ) throws NumberFormatException {
int count = 0;
switch (args.length) {
case 1: count = Integer.parseInt(args[0]); break;
default: System.out.println(USAGE);
//Defines method for processing and printing students within the
//EdronProject class
EdronProject edp = new EdronProject(count);
edp.processStudents();
edp.printStudents();
class Student {
//Define integer values for the 5 subject's grades, the gradeCounter (used
//in the processing stage) and the student name string
private int
gradeCounter,
grade1,
grade2,
grade3,
grade4,
grade5;
private double total;
private String studentName;
//Use setter getter methods for the student name to be retrieved
public void setStudentName(String name) {
studentName = name;
public String getStudentName() {
return( studentName );
//Use setter getter methods for the grades inputted to be retrieved
//by the processing stage
public void setGrade(int gradeNo, int grade) throws IllegalArgumentException {
switch( gradeNo) {
case 1 : grade1 = grade; break;
case 2 : grade2 = grade; break;
case 3 : grade3 = grade; break;
case 4 : grade4 = grade; break;
case 5 : grade5 = grade; break;
default: throw new IllegalArgumentException("ERROR: Bad grade number passed!");
//Increase grade counter for it to register the number of grades inputted
//by user
gradeCounter++;
public int getGrade(int gradeNo) throws IllegalArgumentException {
int grade = 0;
switch( gradeNo) {
case 1 : grade = grade1; break;
case 2 : grade = grade2; break;
case 3 : grade = grade3; break;
case 4 : grade = grade4; break;
case 5 : grade = grade5; break;
default: throw new IllegalArgumentException("ERROR: Bad grade number passed!");
//Return grade values for them to be used by the processing stage
return( grade );
//Calculate the total by adding al 5 grade values
public double getTotal() {
total = (getGrade(1) + getGrade(2) + getGrade(3) + getGrade(4) + getGrade(5));
//Total value returned for it to be used to calculate the average
return total;
//Average is calculated by dividing the total over the grade
//counter (number of grades inputted)
public double getAverage() {
return ( (gradeCounter == 0) ? 0 : total / gradeCounter);//Get input from user for student's 5 grades which are set as Grade 1, 2, 3, 4, 5
//and each five inputs for the student are saved to their own list along with the
//student name
public void processStudents() {
for (int counter = 0; counter < studentCount; counter++) {
Student student = new Student();
student.setStudentName(JOptionPane.showInputDialog("Enter student's name:"));
student.setGrade(1, Integer.parseInt(JOptionPane.showInputDialog( "Enter the student's grade for Psychology \n(You may ONLY use whole positive numbers ranging from 0 to 10)")));
student.setGrade(2, Integer.parseInt(JOptionPane.showInputDialog( "Enter the student's grade for Math \n(You may ONLY use whole positive numbers ranging from 0 to 10)")));
student.setGrade(3, Integer.parseInt(JOptionPane.showInputDialog( "Enter the student's grade for Art \n(You may ONLY use whole positive numbers ranging from 0 to 10)")));
student.setGrade(4, Integer.parseInt(JOptionPane.showInputDialog( "Enter the student's grade for Science \n(You may ONLY use whole positive numbers ranging from 0 to 10) ")));
student.setGrade(5, Integer.parseInt(JOptionPane.showInputDialog( "Enter the student's grade for English \n(You may ONLY use whole positive numbers ranging from 0 to 10)")));
list.add(student);
//Begin printting stage for each student entered
public void printStudents() {
for ( int i = 0; i < list.size(); i++ ) {
Student s = list.get(i);
printStudent(s);
//Print the student name along with each grade entered separated by commas
//and the total and average values in separate lines
private void printStudent(Student student) {
System.out.println("Student Name: "+student.getStudentName()
+", Pych: "+student.getGrade(1)
+", Math: "+student.getGrade(2)
+", Art : "+student.getGrade(3)
+", Sci : "+student.getGrade(4)
+", Eng : "+student.getGrade(5)
+",\n Total : "+student.getTotal()
+",\n Average: "+student.getAverage()+"\n");
Maybe you are looking for
-
Has the NVidia GeForce 8600M GT logic board replacement program been extended by a year?
I have heard that the logic board replacement program for MacBooks Pro with the failed NVidia 8600M GT chip has been extended from 3 to 4 years after the date of original purchase. However, a local AASP had no knowledge of such an extension. Is this
-
Photoshop CC 2014: lost advance tab in menu Archive file info
Hi to all. Recently I install Photoshop CC 2014, and I can't find the advance tab in the window "File Info" inside the Archive Menu, when I choose it. did we lost this tab in CC2014? Can I find this "advance" tab in other menu into Photoshop CC 2014?
-
TimeInMillis different in java than in C
I have a a problem getting a match between the epoche seconds derived within a C program and the return value of System.currentTimeMillis(); Here is an example: * Simple C program for running on Windows Machines * My testing is occuring on Win2K #inc
-
Getting started with HP Connect
I downloader the HP Connect app to my android phone and my hp laptop. I looks like I've lost some o my photos. Ii don't know what to do and not techie enoug to understand what I'm find on the web. Help.
-
AE CC crash when drag jpg and png files to comp
Hi I have noticed photoshop exports of jpg and png files cause AE CC to crash when drag these files to comp Same jpg and png exported from CS6 do not cause crash.