SQVI - Summing of rows
Hi,
I have three to four value columns and would like to see the row totals and not column totals. How to do that in SQVI?
Best Regards
Faisal
Hai Faisal,
Good. Once you got all the Tabs without any data, In same excel
one time settings were required.
In case if excel <2007 , do
Tools -- Macro-- Security
and Security Level Tab select LOW
in Trusted sites Tab Put the TICK MARK
In Case Excel is 2007 or above
Excel icon ( Top left)
Click the "Excel Options" button in the lower right.
Click the "Trust Center" button on the left. Then, at the bottom right, select "Trust Center Settings"
In the next window, select "Macro Settings," then select the radio button for "Enable all macros."
Click OK
OK
AND SAVE THE VIEW AS A LAYOUT, MAKE IT DEFAULT, if you dont require some Tabs like Sub 1, sub 2 remove and store it as a layout.
Whenever the report is executed it will open the data in Excel.
With this facility, you can go lot.
Regards,
Mani
Similar Messages
-
How to do sum of rows selected in Html_db report
I want to display sum of rows (based on the values selected in in a particular col)in html_db report
Hi Tyler;
Can you please take a look at my post?
Possible Bug in 1.6 Report Totals?
I am having some problem with Totals in a report. -
SUM two ROWS in the SAME Table
Hi,
I have a problem with this issue. I want to sum two rows from the same table, but I don´t know how to do that. I tried to do it with CTE, but always I get the same error "Ambiguous". I would like to ask you, if there is other manner to get that
data (sum two rows) and if it is possible to see examples about it.
Thank you in advanceHi Vaibhav,
I leave you my scrip:
USE Modelling
GO
--TABLE Aer_Lingus_Income_Statement
IF OBJECT_ID('Aer_Lingus_Income_Statement') IS NOT NULL
DROP TABLE Aer_Lingus_Income_Statement
GO
CREATE TABLE Aer_Lingus_Income_Statement
ID [nvarchar](255) NOT NULL,
Name_Account [nvarchar](255) NULL,
Company [nvarchar](255) NULL,
Level0_Account [nvarchar](255) NULL,
Level1_Account [nvarchar](255) NULL,
Level2_Account [nvarchar](255) NULL,
Level3_Account [nvarchar](255) NULL,
Level4_Account [nvarchar](255) NULL,
Level5_Account [nvarchar](255) NULL,
Level6_Account [nvarchar](255) NULL,
Level7_Account [nvarchar](255) NULL,
Level8_Account [nvarchar](255) NULL,
Year_2006 decimal (15,2) null,
Year_2007 decimal (15,2) null,
Year_2008 decimal (15,2) null,
Year_2009 decimal (15,2) null,
Year_2010 decimal (15,2) null,
Year_2011 decimal (15,2) null,
Year_2012 decimal (15,2) null,
Year_2013 decimal (15,2) null,
GO
ALTER TABLE Aer_Lingus_Income_Statement
ADD CONSTRAINT PK_Aer_Lingus_Income_Statement PRIMARY KEY (ID)
GO
INSERT INTO Aer_Lingus_Income_Statement
SELECT *
FROM Aer_Lingus_data_Income
IF OBJECT_ID('Aer_Lingus_Income_Statement_Historic') IS NOT NULL
DROP VIEW Aer_Lingus_Income_Statement_Historic
GO
CREATE VIEW Aer_Lingus_Income_Statement_Historic
as
Select Level0_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Level0_Account ='Revenue'
Group by Level0_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account= 'Passenger revenue' and Level0_Account ='Revenue'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account= 'Ancillary revenue' and Level0_Account ='Revenue'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account= 'Other revenue' and Level0_Account ='Revenue'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account= 'Cargo revenue' and Level0_Account ='Revenue'
Group by Name_Account
UNION ALL
Select Level0_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Level0_Account ='Operating expenses'
Group by Level0_Account
UNION ALL
Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Level1_Account ='Staff costs' and Level0_Account ='Operating expenses'
Group by Level1_Account
UNION ALL
Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Level1_Account ='Depreciation, amortisation and impairment' and Level0_Account ='Operating expenses'
Group by Level1_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Aircraft operating lease costs' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Fuel and oil costs' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Maintenance expenses' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Airport charges' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='En-route charges' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Distribution costs' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Ground operations, catering and other operating costs' and Level0_Account ='Operating expenses'
Group by Name_Account
UNION ALL
Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Level1_Account ='Other (gains)/losses - net' and Level0_Account ='Operating expenses'
Group by Level1_Account
UNION ALL
Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
Where Name_Account ='Employee profit share' and Level0_Account ='Operating expenses'
Group by Name_Account
GO
WITH sumasRevenue
AS (
SELECT Name_Account, ID
, sum(Year_2006) AS Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
WHERE Level0_Account = 'Revenue'
GROUP BY Name_Account, ID
WITH ROLLUP
, total
AS (
SELECT Y2006,Y2007 ,Y2008,Y2009 ,Y2010 ,Y2011 ,Y2012 ,Y2013
FROM sumasRevenue
WHERE Name_Account IS NULL
sumasOperatingExpensive
AS (
SELECT Name_Account, ID
, sum(Year_2006) AS Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
FROM Aer_Lingus_data_Income
WHERE Level0_Account = 'Operating expenses'
GROUP BY Name_Account, ID
WITH ROLLUP
, total1
AS (
SELECT Y2006,Y2007 ,Y2008,Y2009 ,Y2010 ,Y2011 ,Y2012 ,Y2013
FROM sumasOperatingExpensive
WHERE Name_Account IS NULL
SELECT distinct ID , s.Name_Account,
(s.Y2006* 1.0 - t.Y2006) AS [V2006] ,(s.Y2007* 1.0 -T.Y2007 ) as [V2007] , (s.Y2008* 1.0 /T.Y2008 ) as [V2008],(s.Y2009* 1.0 /T.Y2009 ) as [V2009],
(s.Y2010* 1.0 /T.Y2010 ) as [V2010],(s.Y2011* 1.0 /T.Y2011 ) as [V2011],(s.Y2012* 1.0 /T.Y2012 ) as [V2012],(s.Y2013* 1.0 /T.Y2013 ) as [V2013]
FROM sumasRevenue AS s , sumasOperatingExpensive AS t
Where ID IS NOT NULL
UNION ALL
SELECT distinct ID,COALESCE(s.Name_Account,'NON CURRENT ASSETS') AS Name_Account ,
sum (s.Y2006* 1.0 / t.Y2006) as V2006,sum (s.Y2007* 1.0 / t.Y2007) as V2007,sum (s.Y2008* 1.0/ t.Y2008) as V2008,sum (s.Y2009* 1.0/ t.Y2009) as V2009,sum (s.Y2010* 1.0/ t.Y2010) as V2010,
sum (s.Y2011* 1.0 / t.Y2011) as V2011,sum (s.Y2012* 1.0/ t.Y2012) as V2012,sum (s.Y2013* 1.0/ t.Y2013) as V2013
FROM sumasRevenue as s , sumasOperatingExpensive as t
Where ID IS NULL and Name_Account IS NULL
GROUP BY Name_Account, ID
WITH ROLLUP
select *
from Aer_Lingus_Income_Statement_Historic
Thank you in advance -
Table -- sum of rows and columns?
I was wondering if anyone has a suggestion to how I can easily generate the sum of each row and column in a two dimensional table? This is what I've got so far:
public class SumRowsColumns {
public static void main (String[] args) {
int[][] table = new int[2][3];
// gets the values
for (int i = 0; i < table.length;
i++) {
for (int j = 0; j < table.length;
j++)
table[i][j] = Terminal.lesInt(); // Terminal is a class that can read the terminal input
System.out.println("\t\t\t\tSum:");
// prints the values
for (int i = 0; i < table.length;
i++) {
for (int j = 0; j < table[i].length;
j++) {
System.out.print("\t" + table[i][j]);
System.out.println();
// sum of first column
int sumColumn = 0;
for (int i = 0; i < table.length;
i++) {
sumColumn += table[i][0];
System.out.print("\nSum:\t");
System.out.println(sumColumn);
Example of output:
1
2
3
4
5
6
Sum:
1 2 3
4 5 6
Sum: 5This is the output I'd like:
1
2
3
4
5
6
Sum:
1 2 3 6
4 5 6 15
Sum: 5 7 9One way of getting the sum for all the columns is to make a for-loop for each one of them, but there has to be a better way. I could apply the same hack to get the sum of the rows, but I still wouldn't know how to get the layout I want.After many hours of frustration I finally solved it (for-loops can be confusing, man) after I got a hint from a post in another forum: http://www.linuxquestions.org/questions/showthread.php?postid=624021#post624021
A more logical name to the integers actually helped a lot too. And here's the final product:
public class SumRowsColumns {
public static void main (String[] args) {
int[][] table = new int[2][3];
// gets the values
for (int row = 0; row < table.length;
row++) {
for (int col = 0; col < table[row].length;
col++)
table[row][col] = Terminal.lesInt(); // Terminal is a class that reads the terminal input
System.out.println("\t\t\t\tSum:");
// prints the values and sum of each row
for (int row = 0; row < table.length;
row++) {
for (int col = 0; col < table[row].length;
col++) {
System.out.print("\t" + table[row][col]);
int sum = 0;
for (int col = 0; col < table[0].length;
col++) {
sum += table[row][col];
System.out.println("\t" + sum);
System.out.print("\nSum:");
// sum of each column
for (int col = 0; col < table[0].length; // table[0].length is the length of row 0 (the number of columns)
col++) {
int sum = 0;
for (int row = 0; row < table.length; // table.length is the number of rows
row++) {
sum += table[row][col];
System.out.print("\t" + sum);
System.out.println();
} -
Need help with Expressions to get the sum of rows between dates
Date Total
8/06/2010 $2000
8/10/2010 $5000
8/28/2010 $2500
9/10/2010 $5000
9/16/2010 $2000
9/25/2010 $7000
9/28/2010 $2500
I need sum of rows based on month. I have tried following syntax. It did not work, which is returning $0. Appreciate any help i get.
=sum(iif(Date.value>="8/01/2010" AND Date.value<="8/30/2010",Total.value,0))Hi RG K,
According to your description, you want to calculate sum of total based on month use expression, but the expression does not work. If that is the case, please refer to the following steps:
In design surface, right-click Insert and click Text Box.
Right-click inside of the text box, then click expression.
In Expression text box, type the expression like below:
=sum(iif(Fields!Date.Value>="8/01/2010" AND Fields!Date.Value<="8/30/2010",Fields!total.Value,CDec(0)))
In this expression, the data type of total is Decimal, so we need to convert 0 to Decimal use CDec() function. If data type of total is Double, we need to use CDbl() function.
The following screenshot is for your reference:
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
How do I sum a row in numbers 09?
I am a teacher wanting to sum grades by row, not column.
I've tried dragging the black plus sign down as videos indicate.
No luck...
It is very time intensive to do this by hand when I know there has to be a simply way.
please and thank you--If you want to sum a row, select the cell where you want the answer, then type the equal sign ("="), then the function you want (in your case "sum(", include the open paerenthesis, click the row header (the number on the very left):
they type the close parenthesis:
In this example :
A7=SUM(5:5)
this is shorthand for.... select cell A7, then type (or copy and paste from here) the formula:
=SUM(5:5)
you can also use the "quick" method which is:
1) select the row
2) drag the sum tag from the quick caluclations from the bar at the bottom to th ecell where you want it: -
Hi, I added a column checkBox as column9 in datagridview. I need get sum of rows column6 if column9 checked is true. I have this code:
private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
int sum = 0;
for (int i = 0; i < dataGridView2.SelectedRows.Count; i++)
sum += Convert.ToInt32(dataGridView2.Rows[i].Cells[6].Value);
test.Text = sum.ToString();
Please help meHi Ali Nom,
According to your description, you'd like to get the sum of rows column6 if column9 checked is true.
I wrote a sample for you.
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
if (dataGridView1.Columns[e.ColumnIndex].Name == "Column9")
int sum = 0;
List<DataGridViewRow> dr = new List<DataGridViewRow>();
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{ //collect the selected rows. //the Column9 is Cells[8], the Column6 is Cells[5]
if (dataGridView1.Rows[i].Cells[8].Value != null && dataGridView1.Rows[i].Cells[8].Value.ToString().Equals("True"))
dr.Add(dataGridView1.Rows[i]);
for (int i = 0; i < dr.Count; i++)
sum += Convert.ToInt32(dr[i].Cells[5].Value);
this.Text = sum.ToString();
dataGridView1.Invalidate();
private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
if (dataGridView1.IsCurrentCellDirty)
dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
#DataGridView.CurrentCellDirtyStateChanged Eventhttp://msdn.microsoft.com/en-US/library/system.windows.forms.datagridview.currentcelldirtystatechanged(VS.80).aspx
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
hi all,
i have a requirement where we have to calculate sum of the row values in advanced table
when i click on ADDROW button a new row is displayed after entering the values
i need to get the sum of values that i enter into the new row
i know about RECALCULATE button which gives sum of columns but i need to get the sum of the rows
plz help me.........
thanx in advance
DEVHi Dev ,
You need to make use of iteration , loop through every record in the VO get the column value and keep adding it
to obtain the sum .
Here is the code to loop through and get the column value
OAApplicationModule am = oapagecontext.getApplicationModule(oawebbean);
int sum = 0;
OAViewObject oaviewobject =(OAViewObject)am.findViewObject("ApplicationsListVO"); // your vo name attached to table region
if(oaviewobject!=null)
oapagecontext.writeDiagnostics(this,"View Object is exists",OAFwkConstants.STATEMENT);
int rowcountValue = oaviewobject.getRowCount(); // retruns no of rows
Row rowAdv= oaviewobject.first();
RowSetIterator iterator = oaviewobject.createRowSetIterator("iterator");
iterator.setRangeStart(0);
iterator.setRangeSize(oaviewobject.getRowCount());
for(int i=0; i<iterator.getRowCount(); i++)
oapagecontext.writeDiagnostics(this,"Inside For loop ",OAFwkConstants.STATEMENT);
rowAdv =iterator.getRowAtRangeIndex(i); // start from 0 to fetch count ( no of rows )
if(rowAdv != null)
if(rowAdv.getAttribute("VacancyName")!=null) // get your column name
vacancyValue = rowAdv.getAttribute("VacancyName").toString();
Sum = sum +vacancyValue ; // Obtain the sum here
Let me know if you need further inputs .
Keerthi -
Using aggregation in xslt to display sum of rows after grouping in CQWP
there is a list in SP which has employee name, project name, and weightage. now there is a requirement to produce a customized view in CQWP where data is grouped by project there must be 2 columns one for projects and other for SUM of percentage of each
row in each project. In header i have a template as no text which hides the text. and in itemstyle.xsl i have made a template as mystyle which makes columns and displays data. i just need to add SUM of each row of a project and display it together with project
and the rows must not be shown.
<xsl:template name="MyStyle" match="Row[@Style='MyStyle']" mode="itemstyle">
<table border='1'>
<tr>
<td><h2>Project</h2></td>
<td><h2>Percentage</h2></td>
</tr>
<tr>
<td colspan="1"><h3><xsl:value-of select="@Project" /></h3></td>
<td>
<xsl:value-of disable-output-escaping="yes" select="@Percentage" />
</td>
</tr>
</table>
</xsl:template>
I am not able to figure out how to aggregate this thing. need help!thanks again, one more Q.
in XSLT mapping i have written for loop for complete structure.
example : <Details>
<node1>
<node2>
</details>
in XSLT mapping
<xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">
<Details>
</Details>
</xsl:for-each>
if i add the field at target side....then i will come under details node and it will be repeated.
how to declare in XSLT mapping. -
Summing the Rows and Columns in an Array
I am importing a 2-dimensional array of integers.(which is held in a 2-dimensional array)
I need to store the row sums and column sums in separate 1-dimensional arrays.
I can get the integers in and print out a list along with the grand total(sum of all).
But, how do I pass each row's and each column's value in to my sumRow and sumCol methods to get the sum for each row and each column?
Can I do the row and column summing in the same "for" statement where I calculate the "grand total"? Or am I making this more difficult than it is?
Would appreciate any help.
This is what I have so far:
import java.awt.Graphics;
import java.applet.Applet;
public class TwoWayTable extends Applet {
int numRows;
int numCols;
int [] [] cell;
int [] rowSum;
int [] colSum;
int grandTotal;
public TwoWayTable(int [][] data){
grandTotal = 0;
cell = new int [data.length][data.length];
for(int i = 0; i < data.length; i++)
for(int j = 0; j < data.length; j++){
cell[i][j] = data[i][j];
grandTotal += cell[i][j];
System.out.println(cell[i][j]);
System.out.println(grandTotal);
public int sumRow(int [] data2){
int rowaccumulator=0;
rowSum = new int[data2.length];
for(int numRows = 0; numRows < rowSum.length; numRows++){
rowaccumulator += rowaccumulator + rowSum[numRows];
return(rowaccumulator);
public int sumCol(int [] data3){
int colaccumulator = 0;
colSum = new int[data3.length];
for(int numCols = 0; numCols < colSum.length; numCols++){
colaccumulator += colaccumulator + colSum[numCols];
return(colaccumulator);Thanks for your input.
I'll make the changes that you suggest.(after this)
My output prints:
4 6 3 8 21
9 1 5 3 18
13 7 8 11 39
numbers are right, but I need to format the table
the output needs to look like this:
int int int int | rowsum
int int int int | rowsum
colsum colsum colsum colsum | total
How do I do this?
I have no idea?
I'm supposed to call a "void setMargins( )" method to line this up, without
using the exotic formatting in the IO library.
I'm also supposed to use "public String toString( )"
This is what I have so far:
import java.awt.Graphics;
import java.applet.Applet;
public class TwoWayTable extends Applet {
int numRows;
int numCols;
int [] [] cell;
int [] rowSum;
int [] colSum;
int grandTotal;
public TwoWayTable(int [][] data){
cell = new int [data.length][data.length];
for(int i = 0; i < data.length; i++){
for(int j = 0; j < data.length; j++){
cell[i][j] = data[i][j];
calcTotals(cell);
for(int i = 0; i < cell.length; ++i){
for(int j = 0; j < cell.length; ++j){
System.out.print(cell[i][j] + " ");
System.out.println(rowSum[i] + " ");
for(int j = 0; j < cell.length-1; ++j){
System.out.print(colSum[j] + " ");
System.out.println(colSum[cell.length-1] + " " + (grandTotal));
public void calcTotals(int [][] data2){
grandTotal = 0;
rowSum = new int[data2.length];
colSum = new int[data2.length];
for(int numRows = 0; numRows < data2.length; numRows++){
for(int numCols = 0; numCols < data2.length; numCols++){
grandTotal += data2[numRows][numCols];
rowSum[numRows] += data2[numRows][numCols];
colSum[numCols] += data2[numRows][numCols]; -
Sum of rows without Filter impact
Hi,
I've department, category( as charaterstic) in rows and sales in coloumns.
But my requirement is if I filter on departmnet the total result remains the same no change on total sum.
Whereas against the filter value only filter value is displayed which is obvious.
Pls advice.
Thx
Rit is not being answered but still I'm closing it
-
How to get a Sum of rows, when i use the property max. rows p. page ?
Hi all.
I've got a query and get a lot of rows (amounts) back.
Now i want to have max. 21 rows per page.
So, first i used the property "max. rows p. page"=21.
But i want a have Sum-Field p.page too, which shows the sum of the amount p. page at a >fixed place (bottom, left) at the page.
this didnt work well....
Because when i have 30 rows, then the sum will shown at the second page (because the sum-field its after the repeating frame).
...Now i forgot the property and placed a function and two placeholder in the query like this:
Function:
:cp_row:=:cp_row +1;
if (mod (:cp_row,21)=0)) then :CP_pagenr:=:CP_pagenr+1;
Placeholders: cp_row, cp_pagenr
Now i want to use :CP_pagenr to change the group - but Report Builder says: I cant... because placeholder are not allowed to change a group.
So.. perhaps anyone can give me a hint how i can do this ?
Thanks a lot...hello.
that sound to me as you wanted a running total. check out the metalink knwoledge base and search for running total and you will find a note on how to do that.
regards,
the oracle reports team --pw -
Sum calculated rows and columns
I have written a SQL report to count the number of offenses by levels of disciplinary actions. Now I want to total
the counts for the rows and columns. How do I do this? Below is my code. It produces column headings with counts. Ie.
Offense Description Level I Level II Susps Terms
2 Minor Violations 0 1
0 0
SELECT
UPPER(DESCRIPTION) as OFFENSE,
SUM(CASE
WHEN OUTCOME = 'LEVEL I'
THEN 1
ELSE 0
END) as LEVELI,
SUM(CASE
WHEN OUTCOME = 'LEVEL II'
THEN 1
ELSE 0
END) as LEVELII,
SUM(CASE
WHEN OUTCOME = 'SUSPEND'
THEN 1
ELSE 0
END) as SUSPEND,
SUM(CASE
WHEN OUTCOME = 'TERM'
THEN 1
ELSE 0
END) as TERM
FROM
PAGRDI
Where
R_DATE >= '2014-01-01' and R_DATE <= '2014-01-31'
Group by
DESCRIPTION
Order by
OFFENSEHi Wildcatgirl,
According to your description, you have used T-SQL to get the counts for different OUTCOME. Now you want to get the total for each OFFENSE and OUTCOME. Right?
In this scenario, since you have already get those counts with T-SQL query, so in your dataset it will have data fields below: OFFENSE, LevelI, LevelII, SUSPEND, TERM. We just need to drag these data fields into a table, add a column at the end of the table
and use expression to sum the counts for different OUTCOME. Then we can add a total for the detail row. We have tested this scenario in our local environment. Here are screenshots for your reference:
Reference:
Tables (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Can we add(sum) the rows while quering the whole table in one statement.
Hi,
I have a table "create table test1(id number(5), name varchar2(10), salary number(10,2))" with the data
ID NAME SALARY
1 AAAAAA 55000
2 BBBBB 15430
3 CCCCC 15430
4 DDDDD 25430
5 EEEE 29830
6 FFFFF 7645
7 GGGGG 6546
8 HHHHH 9645
9 IIIIII 7584
I need a select query which gives the result like this ie.., the 10th row should be the sum of all the 9 rows...
ID NAME SALARY
1 AAAAAA 55000
2 BBBBB 15430
3 CCCCC 15430
4 DDDDD 25430
5 EEEE 29830
6 FFFFF 7645
7 GGGGG 6546
8 HHHHH 9645
9 IIIIII 7584
10 Total 172540Or;
create table t as (
select 1 id, 'AAAAAA' name, 55000 salary from dual union all
select 2, 'BBBBB', 15430 from dual union all
select 3, 'CCCCC', 15430 from dual union all
select 4, 'DDDDD', 25430 from dual union all
select 5, 'EEEE', 29830 from dual union all
select 6, 'FFFFF', 7645 from dual union all
select 7, 'GGGGG', 6546 from dual union all
select 8, 'HHHHH', 9645 from dual union all
select 9, 'IIIIII', 7584 from dual);
Table createdQuery;
with sub_tot as (
select max(id) + 1 max_id,
'Total' name,
sum(salary) sum_sal
from t)
select id, name, salary from t
union all
select max_id, name, sum_sal from sub_tot
order by id;
ID NAME SALARY
1 AAAAAA 55000
2 BBBBB 15430
3 CCCCC 15430
4 DDDDD 25430
5 EEEE 29830
6 FFFFF 7645
7 GGGGG 6546
8 HHHHH 9645
9 IIIIII 7584
10 Total 172540
10 rows selected -
Summing Selected Rows in Column Depending on Value in Another Column
I'd like to sum only the values in selected rows in a given column depending on the value of another column in the same row. For example, suppose I have a table (please disregard the underscores, needed for correct alignment):
___A____B____C___D
1__5___10___15___0
2_20___25___30___1
3_35___40___45___1
4_50___55___60___0
5__sum(D=1)
In cell B5, I'd like to compute the sum of only rows in column B for which the value of the corresponding column D is 1. In this case B5 would be 65.
How can I do this using functions? Is it possible to do it for a variable range of rows without specifying each row individually?
Thanks,
DaveYou should place your formula to other collumn then calculated ones or in another table. You will be able to calculate whole collumns with: =SUMIF(D;“=1”;B)
Formula for your example is: =SUMIF(D1:D4;“=1”;B1:B4)
VB
Maybe you are looking for
-
Problem with login on(ERROR 10061)
hie all i'm having a problem with logging on to the system,. everything else installed ok and is working fine. i think its my connection to the server, i used Ms loopback.. help on the configuration especially in the windows folder(system32/drivers/e
-
Install ERP ECC 6.0 with EHP4 and JAVA stack (usage type)
Hi all, I need to install ECC with EHP4 and also JAVA stack. I know that I have to install 2 stacks with different SID and oracle homes, firts I have to install ABAP stack and then the JAVA stack, but wich usage type should I choose for JAVA STACK? W
-
HT5634 Boot Camp support drivers install unsupported MacBook Air 11inch
I successfully installed WIndows 7 64bit from a USB on my 2013 MacBook Air 11inch and it seems to function properly. When I tried to install WIndows support software I keep getting "Boot Camp x64 is unsupported on this compter model" message. The Bo
-
Simple caching in singleton DAO
Suppose I was to use a DAO like this in a web application. Different threads would be concurrently accessing this code from different servlets, struts actions, JSP pages, whatever. import java.util.Map; import java.util.HashMap; public class CacheSin
-
If I were to buy the 7 Home Premium SP1 64bit, System Builder OEM DVD 1 Pack from Amazon to install Microsoft Windows 7 on my Macbook Pro, would it be compatible with my computer if I put it in bootcamp? (I have all of the current software updates)