Horizontal Totals Of Subtotals In A Matrix
Sep 19, 2007
I'll admit I am fairly new to the reporting services, but I managed to figure most things out so far except this one. I have a matrix report where I have column groupings of:
Sales person
Region
Basically, the report shows sales by sales person and region, and I added subtotals to each so each salesman/region combination gets subtotals, as does each salesman entry. Now, the one piece missing is the 'total of the subtotals' so to speak. So if I have something like:
Salesman Region Sales Jan Sales Feb Sales Mar
001 A $100 $175 $50
B $100 $200 $100
C $200 $100 $50
Total $400 $475 $200
002 A $100 $175 $50
B $100 $200 $100
C $200 $100 $50
Total $400 $475 $200
Grand Total $800 $950 $400
What I want to do is sum up the totals and add another column like so:
Salesman Region Sales Jan Sales Feb Sales Mar
001 A $100 $175 $50
B $100 $200 $100
C $200 $100 $50
Total $400 $475 $200 $1075
002 A $100 $175 $50
B $100 $200 $100
C $200 $100 $50
Total $400 $475 $200 $1075
Grand Total $800 $950 $400 $2150
And that is where I am stuck. In Report Designer, with the existing matrix report as above, how do I get these horizontal totals of the subtotals?
View 5 Replies
ADVERTISEMENT
Feb 28, 2007
I am new to SQL and have been given the task of adding Subtotals and a Grand Total to a report. Below is my code...can someone point me in the right direction?
SELECT
POP30300.POPRCTNM,
receiptdate,
VENDORID,
VENDNAME,
POP30310.ITEMNMBR,
SERLTNUM LOTNUMBR,
LandedCost = ISNULL(CONVERT(money,LOTATRB1),0),
STNDCOST = ISNULL(CONVERT(money,STNDCOST),0),
LandedCostStatus = CASE WHEN CONVERT(money,ISNULL(LOTATRB1,0)) = 0 THEN 'Missing' ELSE
CASE WHEN (CONVERT(money,ISNULL(LOTATRB1,0))-STNDCOST)/STNDCOST*100 NOT BETWEEN -30 AND 30 THEN 'OutOfRange' ELSE 'Okay' END END,
PONUMBER,
ISNULL(POP30310.UNITCOST,0) / ISNULL(POP30310.UMQTYINB,1) POPRICE,
ISNULL(QTYAVAIL,0) QTYAVAIL
FROM ODB.dbo.POP30300 POP30300 (NOLOCK)
INNER JOIN ODB.dbo.POP30310 POP30310 (NOLOCK) ON POP30300.POPRCTNM = POP30310.POPRCTNM
INNER JOIN ODB.dbo.POP30330 POP30330 (NOLOCK) ON POP30310.POPRCTNM = POP30330.POPRCTNM AND POP30310.RCPTLNNM = POP30330.RCPTLNNM
INNER JOIN ODB.dbo.IV00301 IV00301 (NOLOCK) ON POP30330.ITEMNMBR = IV00301.ITEMNMBR AND POP30330.SERLTNUM = IV00301.LOTNUMBR
LEFT JOIN ODB.dbo.IV00101 IV00101 (NOLOCK) on POP30330.ITEMNMBR = IV00101.ITEMNMBR
LEFT JOIN (SELECT ITEMNMBR, LOTNUMBR, SUM(QTYRECVD-QTYSOLD-ATYALLOC) QTYAVAIL
FROM ODB.dbo.IV00300 IV00300 (NOLOCK)
GROUP BY ITEMNMBR, LOTNUMBR) QTYAVAIL
ON POP30330.ITEMNMBR = QTYAVAIL.ITEMNMBR AND POP30330.SERLTNUM = QTYAVAIL.LOTNUMBR
WHERE POP30300.POPTYPE IN (1,3)
AND POP30300.VOIDSTTS = 0
-- AND POP30300.receiptdate > DATEADD(dd,-35,GETDATE())
AND ISNUMERIC(LOTATRB1) = 1
AND ISNULL(QTYAVAIL,0) <> 0
View 20 Replies
View Related
Aug 31, 2006
I have this:
2003 2004 2005 Total
cars apples cars apples cars apples
Tom 3 1 4 2 5 1 16
Sally 0 2 4 1 7 6 20
And I need the last column (the group subtotals) to be like this:
Totals
cars apples
12 4
11 9
So basically, the question is, how do I get the second column-group (cars/apples) subtotals to appear in the last column? As seen, the the subtotal for the first column-group (year) is meaningless.
View 4 Replies
View Related
May 16, 2007
Hello all,
This is all being done under SQL2000 and VS2003
I have a matrix report which is showing user information. The Rows are displaying numbers for each user, and the columns show the user info in weekly increments. I have 7 fields of info for each user. My stored procedure already is set up to give me the correct numbers. I dont need to SUM them or anything. Although in the report designer it forced me to SUM them since it was part of an aggregate. This still worked for me anyhow because it was Summing a single value.
However, at the end of the report i want to display totals for all the users combined, per week. So right now the report is showing 21 weeks, so at the end of the report i should have 21 sets of totals.
I right clicked on the users name column and selected subtotal. This gave me some of what i want. But some of the numbers are not correct. Some of the numbers should not just be a simple SUM of the column. Some of the values should be averages etc. I know how to calculate those values myself (its very simple math) but i dont know how to do it using this setup in the report designer. So in the matrix, for each week, how can i calculate the totals for all the users combined and specify the formula used to get the totals for each field?
thanks
View 1 Replies
View Related
Apr 23, 2007
FY 2006
FY 2007
Total
1ST QTR
2ND QTR
3RD QTR
4TH QTR
Total
1ST QTR
Total
Customer1
Count1
290
271
233
207
1001
200
200
1201
Count2
111
110
123
118
462
113
113
575
Customer2
Count1
12
12
12
Count2
9
9
9
Customer3
Count1
616
540
513
526
2195
531
531
2726
Count2
362
299
324
368
1353
347
347
1700
Customer4
Count1
7
12
15
22
56
26
26
82
Count2
3
1
7
9
20
9
9
29
Customer5
Count1
4
9
2
15
3
3
18
Count2
1
1
1
3
3
3
6
Customer6
Count1
1
0
1
1
Count2
0
0
0
0
I have the matrix above that displays the subtotals per customer(group_row), per quarter(group_column). I added a subtotal to the top group_column (year) so I can get grand total. I need to modify grand total formula to display variance instead.
I don't need to modify the subtotal formula per Customer/quarter , only per cutomer/Year. Is it possible?
View 12 Replies
View Related
May 8, 2007
I would like to set up a report which would look simular to
Mon Tues Wed Thurs Fri Total Month to date total
salesguy1 10 5 11 10 9 45 120
SalesGuy2 9 1 15 0 0 25 89
I have created a matrix which shows the data upto total.
Is there a way to include the Month to date total after total?
Thanks
View 2 Replies
View Related
Mar 5, 2008
Hi
I have a matrix report. It expands to the right when the user chooses the amounts of months he/she wishes to see. Then it is populated with revenues for each month and deportment. On the matrix report I have put in a couple of Subtotals. Some of the totals are empty due to a month in a department with no revenue.
I wish to see a 0 on the subtotal column but I don€™t want to see a 0 on the month column. If I use
=IIF( Fields!Revenue.Value is Nothing, "0", Fields!Revenue.Value)
on the month columns I will see 0 all over the place. But I only want a 0 on the subtotal column. Can I do this?
Thanks in advanced
Kind regards
//Javier
View 5 Replies
View Related
May 8, 2008
Hi all,
I'm wondering if its possible to use the subtotal for one group in a matrix in an expression for another group in the matrix.
Im getting the total number of units someone holds in one column, and need to show the percentage of the total units in another column.
An example of what im doing is below... argh images dont seem to be working when you post then! sorry
the first group is Date - This will show all there quantities anytime a trade occurs.
the second and third groups are Quantity (of units) and % of fund.
Quantity is a running value of all the units the account holder has. The percentage needs to be that number / subtotal of all units on that date. So the expression needs to be something like:
=runningvalue(Fields!Quantity.Value, sum, "matrix1_Account_Reference") / --subtotal of date group-- * 100
any ideas?
Thanks
View 1 Replies
View Related
Apr 9, 2007
Let's say I have raw data that looks something like this
Fruit_name status count
apples Fresh 5
apples rotten 3
pears Fresh 3
pears rotten 2
and I was to matrix it and group on fruit_name and add a subtotal to count. In that subtotal, without changing what was displayed in the details number, could I conditionaly only show a sum of fresh fruit? Example below
Apples 5
Apples 3
-------------------
Total 5
Pears 3
Pears 2
----------------------
Total 3
in a nonmatrix situation I'd use something like
sum(iif(status="Fresh",count,0))
Thanks for the help.
View 3 Replies
View Related
May 31, 2007
I need a sales report that would display weekly amounts either sold or forecasted in matrix (pivot) form.
The data used for the report is like following (INV is sold and FC is forecasted):
rtype
region
week
wgt
INV
EU
1
150
INV
US
2
200
FC
US
2
400
FC
US
3
1000
FC
EU
2
100
I want the report to show data like this:
WEEK 1
WEEK 2
WEEK 3
TOTAL
INV
INV
FC
FC
INV
FC
EU
150
100
150
100
US
200
400
1000
200
1400
So I put region as rows, week and rtype as columns, and wgt as data field. Everything works fine except that there will be no grand totals for INV/FC. What I get is:
WEEK 1
WEEK 2
WEEK 3
TOTAL
INV
INV
FC
FC
EU
150
100
250
US
200
400
1000
1600
How can I get my totals? I know I could tailor my data to get INV/FC values into different columns to show as data fields in matrix report. But in this case, every week would always display 2 columns, which is certainly not what I want.
I also know I could add another matrix report to create a simulated total columns, but I wasn't able to "join" these 2 reports properly, there is always some space between them and the report looks unprofessionally. So I am looking for a way to do that with a single matrix.
Second question: how can I paint entire columns into different colors, so that INV is always green and FC is always blue? I tried customizing background color, but it only paints cells with values inside, leaving empty cells white. Is it possible to have the INV columns green, entirely?
Thank you in advance,
Wapper
View 3 Replies
View Related
Jan 15, 2008
Is there any way to get multiple subtotals in a matrix? For example, one that does a count and the 2nd that does an averages as per the desired result below ...
Code Block
A B C
A 1 2 3
B 2 3 4
C 3 4 5
Total 6 9 12
Avg 2 3 4
View 8 Replies
View Related
Oct 7, 2015
Seems simple. Â People working in departments with different types of hours (regular, overtime, vacation... thus the grid which pivots hours in rows to the appropriate columns). Â I want to subtotal by department, but whenever I try to add totals after to that group, I just get a grand total. Â No subtotals. Â Why?
View 8 Replies
View Related
Apr 16, 2008
Because i get no answers i will try it again:
Hi,
i have the following problem:
I have a matrix with a right subtotal column and this matrix was in a list (because in the end i will have more than one matrix). The list fits perfectly the matrix in design mode. But if i render the report in the viewer or to pdf, an additional blank area (like a blank copy of the subtotal column) was inserted after the right subtotal column of the matrix and increases the list too. You can see this easy by set the backgroundcolor of a list to a color. Without the subtotal column the list fits perfect after rendering. The problem is that this additional blank "column" creates empty pages in .pdf rendering, if the width of the matrix is near the page width. The same behaviour happens if i put the matrix with subtotal in a rectangle.
I must use a list in the end because the the final report contains some matrixes and a subreport.
So is this a bug?
Someone must have this problem too?
Thanks for any help.
View 5 Replies
View Related
Dec 12, 2006
Below is part of a matrix report. Sooo close, but I have two problems I have not been able to solve. Please help as a I have several similar reports to do.
1. Row totals. I have been able to get a row total by adding a row group (i.e., $849.7 in the first row). However it does not display a group total (i.e., the sum of $849.7 and $371.3 for Economic Development) for that column.
I have not been able to add a static column outside of the dynamic groupings. I thought this might be a resolution by displaying the sum of the Estimated Costs in a static column and hoping it would show the group totals the same as with the dynamic column totals. Is there a way to do this?
2. Sorting. The report needs to display the groups based on the descending total values. I have specified the following sorts on the groups: sum(Fields!Estimated_Cost),"matrix1_Proj_Typ_Group" descending (this is the first column) and sum(Fields!Estimated_Cost),"matrix1_Proj_Typ" descending (this is the second column). Neither sort appears to be work.
City
County
Federal
Joint
Estimated Cost
% of Total
Estimated Cost
% of Total
Estimated Cost
% of Total
Estimated Cost
% of Total
Economic Development
Business District Development
$849.7
$816.0
66.83%
$27.2
2.23%
$0.0
0.0%
$6.5
0.53%
Industrial Sites & Parks
$371.3
$131.5
10.77%
$190.4
15.59%
$0.0
0.0%
$36.0
2.95%
Total
$947.6
77.61%
$217.6
17.82%
$0.0
0.0%
$42.5
3.48%
Education
K-12 New School Construction
$1,594.7
$223.0
10.05%
$1,363.5
61.43%
$0.0
0.0%
$0.0
0.0%
Non K-12 Education
$37.8
$3.1
0.14%
$33.2
1.5%
$0.0
0.0%
$0.0
0.0%
School System-wide Need
$587.1
$167.2
7.53%
$419.2
18.89%
$0.0
0.0%
$0.0
0.0%
Total
$393.2
17.72%
$1,816.0
81.82%
$0.0
0.0%
$0.0
0.0%
General Government
Other Facilities
$21.3
$17.5
4.3%
$3.9
0.95%
$0.0
0.0%
$0.0
0.0%
Property Acquisition
$8.8
$6.8
1.68%
$2.0
0.49%
$0.0
0.0%
$0.0
0.0%
Public Buildings
$375.5
$294.2
72.54%
$72.0
17.74%
$3.0
0.74%
$6.2
1.52%
Total
$318.5
78.52%
$77.8
19.19%
$3.0
0.74%
$6.2
1.52%
View 4 Replies
View Related
Apr 1, 2007
Hi,
Is there a tutorial on how to do a matrix report with row & column tables? This is easy on by default in Crystal, but I can't figure out how to do it in RS.
Thanks,
John
View 2 Replies
View Related
May 24, 2007
Hi,
How can I access the subtotal cells/values from each of the columns in Matrix and use them for calculations on other places in the report?
Thanks.
View 4 Replies
View Related
Apr 8, 2008
When i am designing a report using BIDS how do i control the Drilldown on the Matrix Totals. At present when i created a drill down report it works fine for all non total Values but chooses a random Value when it drills on Totals (Usually the first but not always)
Eg if i have a Matix that looks like this
Name, Value1, Value2, Value3
John, 1,1,1 = 3
Mark 2,2,2 = 6
Fred 3,3,3 = 9
Total 6,6,6
If i want to Drill on either the totals at the bottom or the totals on the Right or the bottom, it will choose a random Value eg if i want ot see the totals for John the Column Parameter that it passes to my drill through report will be that for Value 1 which is incorrect.
Any help greatly appreciated.
View 6 Replies
View Related
Aug 21, 2007
I have a matrix report with 2 column Groups and 2 Row Groups ,I need to calculate the Subtotals at Row Group2
2007
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC TOTAL
Current Period Total 1211 1813 3040 1699
CB 1062 1551 2527 1517
BR 149 262 513 182
Prior Year Total 1528 1894 3238 1676
CB 1276 1540 2521 1400
BR 252 354 717 276
Prior Year Chg% Total <the Total here Should not be a sum of the individual percents but a Calculated percentage>
CB -16.77 0.71
BR -40.87 -25.99
With this Matrix this is what i have in the cell
=iif (InScope("matrix1_Ddat_Prod_Mth_Nm"),
iif(InScope("matrix1_Date_Calculations"),iif(fields!Date_Calculations.Value = "Current Period",
iif(fields!Ddat_Prod_Mth_Nbr.Value > Month(Today),COBJ("-"),
Round(Sum(Fields!RecruitsCount.Value),2)),
iif(fields!Date_Calculations.Value = "Prior Year Chg %",
iif(fields!Ddat_Prod_Mth_Nbr.Value > Month(Today),"-",
iif(fields!Ddat_Prod_Mth_Nbr.Value <= Month(Today) And fields!RecruitsCount.value = -100,
"-", Round(Sum(Fields!RecruitsCount.Value),2))),Round(Sum(Fields!RecruitsCount.Value),2))),
iif(Fields!Date_Calculations.Value= "Current Period",
iif(Fields!RecruitsCount.Value= 0,"-",Sum(Fields!RecruitsCount.value)),
iif(Fields!Date_Calculations.Value= "Prior Year",Sum(Fields!RecruitsCount.value),
iif(Fields!Date_Calculations.Value="Prior Year Chg %",iif(ASC(Fields!RecruitsCount.Value)= ASC("-"),"-",Round(First(Fields!RecruitsCount.Value),2)),0)))),
iif(InScope("matrix1_Date_Calculations"),Round(Sum(Fields!RecruitsCount.Value),2),Round(Sum(Fields!RecruitsCount.Value),2)))
i have to replace the red strip with a calculated function that would return a total percentage for that row .
I am using AS 2005 as datasource for this , the AS2005 has the totals calculated but i am not able to pull them into the reporting services .
here is the MDX for that
WITH MEMBER [Measures].[Avg Monthly] AS 'AVG(Descendants([DimDate].[Fiscal Hierarchy].Currentmember),[Measures].[RecruitsCount])' MEMBER [Measures].[Total Prior Year] AS 'Sum([dimdateCalculations].[Prior Year])'
SELECT { [Measures].[RecruitsCount] } ON COLUMNS,
{ ([dimDate].[Fiscal Hierarchy].[Ddat Prod Mth Nbr].ALLMEMBERS
* [Date Calculations].[Date Calculations].ALLMEMBERS
* [dimWritingNumber].[Dwnb Broker Ind].[Dwnb Broker Ind].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( STRTOSET(@dimDateDdatProdYrNbr, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLowestLvlConsolIDNo, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo7, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo6, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo5, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo4, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo3, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo2, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchLvlConsolIDNo, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchTdNm, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@dimProdChainDpchCompanyCd, CONSTRAINED) ) ON COLUMNS
FROM [MRSCUBE])))))))))))
WHERE
( IIF( STRTOSET(@dimProdChainDpchCompanyCd, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchCompanyCd, CONSTRAINED), [dimProdChain].[Dpch Company Cd].currentmember ),
IIF( STRTOSET(@dimProdChainDpchTdNm, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchTdNm, CONSTRAINED), [dimProdChain].[Dpch Td Nm].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo, CONSTRAINED), [dimProdChain].[Dpch Lvl50 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo2, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo2, CONSTRAINED), [dimProdChain].[Dpch Lvl49 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo3, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo3, CONSTRAINED), [dimProdChain].[Dpch Lvl46 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo4, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo4, CONSTRAINED), [dimProdChain].[Dpch Lvl45 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo5, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo5, CONSTRAINED), [dimProdChain].[Dpch Lvl40 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo6, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo6, CONSTRAINED), [dimProdChain].[Dpch Lvl30 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLvlConsolIDNo7, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLvlConsolIDNo7, CONSTRAINED), [dimProdChain].[Dpch Lvl29 Consol ID No].currentmember ),
IIF( STRTOSET(@dimProdChainDpchLowestLvlConsolIDNo, CONSTRAINED).Count = 1,
STRTOSET(@dimProdChainDpchLowestLvlConsolIDNo, CONSTRAINED), [dimProdChain].[Dpch Lowest Lvl Consol ID No].currentmember ),
IIF( STRTOSET(@dimDateDdatProdYrNbr, CONSTRAINED).Count = 1,
STRTOSET(@dimDateDdatProdYrNbr, CONSTRAINED), [dimDate].[Ddat Prod Yr Nbr].currentmember ) )
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
Please help . Thank you
View 2 Replies
View Related
Apr 25, 2008
How do I get sub totals in the matrix of the reports. I have my report in the format of matrix and I want to display the sub totals for the matrix at the end of each row and column. Is there any solution for this????
View 3 Replies
View Related
May 25, 2007
Would some one know how to control the formatting of Matrix Sub totals, such as Border around it, background color and font etc...I can't select the grey textbox that is rendered if sub totals are chosen from the context menu for a group.
Any help will be appreciated.
View 3 Replies
View Related
Feb 8, 2008
I have a Matrix and in the total on the last row i want use conditions for the color on the background , i'm usign the option Subtotal but i cna't read the value for the subtotal for create my conditions , some body now how i will aprecciate
thanks
View 2 Replies
View Related
Jul 9, 2007
Some DB Field ID
X
2007
2008
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
A
X-A
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
B
X- A -B
1
500
10
20
0
0
0
0
0
0
0
20
50
0
100
400
25
10
10
0
0
5
0
25
15
10
10
20
130
270
2
750
10
10
10
20
20
10
10
20
10
10
10
10
150
600
20
20
20
20
30
30
10
10
10
30
30
30
260
340
3
600
All,
I am trying to achieve something as above. Basically, the Months subtotals are represented by A and B. Then (X-A) and (X-A-B) are also the subtotals at the same group level as A and B but don't simply display the total for respective years 2007 and 2008, instead those are remaning totals from X. In order to calculate the remaining totals however, one need to consider the subtotal in previous group. For example, for 2007 its X-A, but for 2008 its X-A-B. I would like to know if this can be achieved using Matrix control. If so, what would be the steps?
Thanks.
View 5 Replies
View Related
May 9, 2015
I have some data grouped in a table by a certain criteria, and for each group it is computed a subtotal for the group. Of the values from each of the group, I want to create a grand total on the report by adding every subtotal from each group.
Example:
...
....
Group1 Â Â Â Â Â Â Â Value
              10
              20
Sub Total 1: Â Â Â Â 30
Group2 Â Â Â Â Â Â Â Â Value
               15
               25
Sub Total 2: Â Â Â Â Â 40
Now, I would like to be able to add subtotal 1 (30) to subtotal 2 (40) and my grand total would be 70. Can I accomplish this task in SSRS?
View 5 Replies
View Related
Oct 2, 2006
I have been providing sales data for a few months now from a table that is set up like this:
Date WorkDay GasSales EquipmentSales
9/1/2006 1 100.00 200.00
9/4/2006 2 50.00 45.00
etc.
As can be seen, the data is daily, i.e., on the first workday of September we sold one hundred dollars in gas and two hundred dollars in equipment. On the second workday of September we sold fifty dollars in gas and forty-five dollars in equipment.
Now, however, the data I have to pull from is cumulative. So, using the last table as an example it would look like this:
Date_WorkDay_GasSales_EquipmentSales
9/1/2006 1 100.00 200.00
9/4/2006 2 150.00 245.00
etc.
To make things more complicated, the powers that be wanted this data presented in this fashion:
Total Sales:
1_2_etc.
300.00 95.00 etc.
So, I have been doing a pivot on a CRT to get the data to look like I want. The code is like this:
with SalesCTE (Month, WorkDay, [Total Sales])
as
(
SELECT
datename(month, cag.date),
cag.WorkDay AS [Work Day],
sum(cag.sales_gas + cag.sales_hgs) AS [Total Sales]
FROM CAG INNER JOIN
Branch ON CAG.[Oracle Branch] = Branch.OracleBranch
group by cag.date, cag.WorkDay
)
select * from SalesCTE
pivot
(
sum([Total Sales])
for WorkDay
in ([1],[2],[3],[4],[5],,[7],,[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23])
) as p
So, my question is:
How do I get the data to give back daily totals instead of the cumulative amounts for each workday? If the query was a simple one, I'd do something like
select [1] as [Day 1], [2]-[1] as [Day 2], [3]-[2] as [Day 3], etc.
but the query is far from normal, with the CRT and the pivot. I can't seem to get it to work how I'd like.
Any advice/answers? Thanks in advance!!!
P.S. I don't know how to get it to quit with the freakin' smileys.... I suppose you can figure out what my code is really supposed to look like above. Needless to say, it doesn't include a devil face and a damn music note...
View 12 Replies
View Related
Jun 29, 2005
I would like to be able to add subtotals for extended_cost and tax_amt for the following query and then a net_cost that is a sum of extended_Cost and tax_amt for each of the orders I have. I believe I need to somehow use the Group by command, but with so many fields from so many fields, I am not sure where to start.
Here is my code so far...
Code:
SELECT Customer.First_Name,
Customer.Middle_Name,
Customer.Last_Name,
Customer.Address,
Customer.City,
Customer.Region,
Customer.Postal_Code,
Customer.Country,
Customer.Customer_ID,
Store.Store_Address,
Store.Store_City,
Store.Store_State,
Store.Store_Zip_code,
Store.Store_Phone_Number,
Store.Store_Fax_Number,
Orders.Order_ID,
Employees.LastName,
Employees.FirstName,
Item.Item_ID,
Item.Taxable_Nontaxable,
Order_Line.Price,
Order_Line.Units_Purchased,
Order_Line.Discount,
Tax_Table.Tax_Rate,
'Extended_Price' = (Order_Line.Price*Order_Line.Units_Purchased*(1-Order_Line.Discount)),
CASE WHEN
Item.Taxable_Nontaxable = 1
THEN
((Order_Line.Price*Order_Line.Units_Purchased*(1-Order_Line.Discount))*Tax_Table.Tax_Rate)
ELSE
((Order_Line.Price*Order_Line.Units_Purchased*(1-Order_Line.Discount))*0)
END AS Tax_Amt
FROM Orders
INNER JOIN Order_Line ON Orders.Order_ID = Order_Line.Order_ID
INNER JOIN Customer ON Orders.Customer_ID = Customer.Customer_ID
INNER JOIN Store ON Orders.Store_Code = Store.Store_Code
INNER JOIN Employees ON Orders.Sales_Person_ID = Employees.EmployeeID
INNER JOIN Item ON Order_Line.Item_ID = Item.Item_ID
INNER JOIN Tax_Table ON Orders.Store_Code = Tax_Table.Store_Code
WHERE Orders.Order_Filled = 0
ORDER BY Orders.Order_ID
COMPUTE SUM((Order_Line.Price*Order_Line.Units_Purchased*(1-Order_Line.Discount))) BY Orders.Order_ID
View 3 Replies
View Related
Jun 18, 2007
Hello Everyone,
I have a dimension that has the following members:
Directors
Senior Managers
Managers
Senior Associates
Associates
But they way they need to be displayed includes subtotals. Senior Managers and Managers are placed into Management and Staff is a total of everyone except Directors. They should appear on the report in something like this:
Directors 10
Senior Managers 15
Managers 9
Management 24
Senior Associates 17
Associates 40
Staff 81
Total 91
What is the best way to do this? Right now I am using a matrix because I am also showing headcounts by Period. Is a table a better way to go? Is it something that should be done in my dimension?
I can do the Total part. I am just not sure how to make the subtotals inbetween the other lines.
Thank you for the help.
-Gumbatman
View 3 Replies
View Related
Feb 8, 2007
I have contracts grouped by project then grouped by division. On the division group header I want to show the subtotal of all active projects only. CountDistinct(Fields!ProjectId.Value) gives me count of all projects.
I can't figure out what I need to get only a subset of projects counted. I need something like:
CountDistinct(Fields!ProjectId.Value & Fields!ProjectStatusId.Value = 1)
but that isn't allowed.
Any help appreciated.
View 3 Replies
View Related
Aug 6, 2015
I got the following code to add a column in a matrix with a variance:
IIF(IsNothing(Previous(Sum(Fields!Amount.Value))) or Fields!year.Value=First(Fields!year.Value,"Category") or Previous(Sum(Fields!Amount.Value))=0,nothing,
(
(Fields!Amount.Value)
/Previous(sum(Fields!Amount.Value))
)
)
This code works fine, except that the first row of the matrix shows an #error
This happens with each matrix where I use this expression. A warning emerges:
rsruntimeerrorinexpression the value expression for the textrun Textbox43.Paragraphs[0].TextRuns[0]' contains an error.
Attempted to divide by zero.
The strange thing is that the part
Fields!year.Value=First(Fields!year.Value,"Category")
should prevent an error and I expect it to show 'nothing'
An screenshot of the table. (each color is a different category. Each row stands for 2013, 2014, 2015)
As you can see, all other 2013 rows show a blank cell, except the first row.
View 3 Replies
View Related
Jan 10, 2008
I have a Matrix table that expands to the right when choosing an amount of months to be shown. Under this matrix I have to Charts. The two charts are situated together, that is no space between them, and to the left of the report.
Now, if I choose a lot of months, say three years the matrix diagram will be huge to the right. The problem I have is that the second diagram, the one on the right, moves to the right depending on how big the report gets, and this is not good at all. The two charts are supposed to be all the way to the left.
How? Why does the right chart move?
Thanks in advanced
Kind Regards
View 1 Replies
View Related
Mar 17, 2015
SELECT
LTRIM(LoanAnalyst) AS [Loan Analyst]
,DischargeType AS [Discharge Type]
,CONVERT(varchar, DateCompleted, 101) AS [Date Completed]
,COUNT(ClaimID) As [Completions]
[Code] ....
This produces this
Loan AnalystDischarge TypeDate CompletedCompletions
Bill ReidType 1 3/3/20151
Bill ReidType 1 2/11/20151
Bill ReidType 2 3/11/201518
Bill ReidType 3 3/11/20151
Bill ReidType 4 3/11/20159
[Code] ....
I would like my results to look like this. I've tried using WITH ROLLUP but it doesn't give me the below.
Loan AnalystDischarge TypeDate CompletedCompletions
Bill ReidType 1 3/3/20151
Bill ReidType 1 2/11/20151
Bill ReidType 2 3/11/201518
Bill ReidType 3 3/11/20151
Bill ReidType 4 3/11/20159
30
[Code] .....
View 3 Replies
View Related
Jul 30, 2007
Hello,
I want to display subtotals for a column only for that page. Like;
Index Value
-----------------------------
1 4
2 5
Subtotal 9
----------------------------
3 1
4 2
Subtotal 3
Total 12
RunningValue gives cumulative totals. I need subtotals for each visible page only. Is there a way to do it ?
Constraints:
I'm using a table. And I shouldn't use page breaks on my report.
Thanks in advance
View 3 Replies
View Related
Apr 23, 2007
How do I create calculated fields based on subtotals?
View 6 Replies
View Related
Jan 28, 2008
For the past two hours I've been looking for a solution to my problem. Any help is appreciated. Basically, I need to know the T-SQL Command(s) that create subtotals and grandtotals within a set of results. I am designing a school transcript generator and I need to calculate the GPA and Credit Hour Totals per Semester, For Example:
Semester 1 Record
Semester 1 Record
Semester 1 Record
Semester 1 Record
Semester 1 Record
Semester 1 Subtotal
Semester 2 Record
Semester 2 Record
Semester 2 Record
Semester 2 Record
Semester 2 Record
Semester 2 Subtotal
Semester 3 Record
Semester 3 Record
Semester 3 Record
Semester 3 Record
Semester 3 Record
Semester 3 Subtotal
Year 1 Grand Total
Thanks for your help in advance...
View 1 Replies
View Related