SSRS 2005 Summing Issue

We have products that have a budget amount and count assigned to them and I need to do the normal sums and variance by product and finally by the category that the product belongs to. The problem is that my dataset contains many rows for each product so I went ahead and put the Budget amount on each row and just use First() on the details section of the table but now I have the issue where I need the sum of the First budget amount/counts in the table footer to report at the category level.

Product	Category	        Sale          Budget Cnt	          Budget Amt

123	1		12	1500		10,000	
123	1		10	1500		10,000		
151	2		45	2600		50,000		
123	1		25	1500		10,000	
151	2		62	2600		50,000

Open in new window

LVL 2
DowntownITAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
thmanConnect With a Mentor Commented:
DowntownIT,
Since your details rows do not list all the rows for the same product and only list the summary, instead of using 2 groups in your layout, you should just use 1 group (category) in the layout and place the product grouping in your command text of the query. When grouping in the query, you sum on sale and counts first and then join with the table that contains budget.
0
 
aelliso3Commented:
Using the part above, can you show an example of what the expected out come is?
0
 
planoczCommented:
Group by Category, then group2 by Product. Place textboxes in group2 footer and sum the values. You do not need to show a detail row, unless you need too.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
DowntownITAuthor Commented:
Planocz,

I am trying what you are suggesting but getting and error. "Aggregate functions can be used only on report items contained in page headers and footers."

I placed a textbox in the group 2 footer and named it sum_txtBx. Now in the group 1 footer I have this expression, =Sum(Reportitems!Sum_txtBx.Value).


Aelliso3, The final result set should be like below. Also, this should be done at the table level if possible.



Category  
    Product    Sale  Budget Cnt.    Budget Amt.
   1
        123    47    1500           10,000

   2
        151    107    2600          50,000

Total          154   4100           60,000

Open in new window

0
 
planoczCommented:
Each column has to look like this....
                       Sale                           Budget Ct.
                    =Fields!Sales.value       =Fields!Budget.value
Totals        =Sum(Fields!Sales.value)       =Sum(Fields!Budget.value)
0
 
DowntownITAuthor Commented:
The sales column needs to be summed and the budget Ct. not summed at the product level.
My dataset contains multiple individual sales to each product that need to be summed at the product level but since the budget is assigned at the product level I can only return the budget amt/cnt as the full value on each individual row in my dataset.

So when I am looking at the totals for a paticluar product, I can use =First(Fields!Budget_Cnt.value) but when I need the totals for a Category, It needs to be the the first budget value from each product in my dataset summed together.

This is what I am looking for,

                                         Product_Name                        Sales                                     Budget

Table Header        =(Fields!Category_Desc.value)

Table Details        =(Fields!Prod_Desc.value)   =Sum(Fields!sales.value)   =First(Fields!Budget.value)  -- The Table Details groups by Prod_Desc

Table Footer                      Totals:                    =Sum(Fields!sales.value)   =Sum(First(Fields!Budget.value)) -- "This does not work"




Thanks for the help.
0
 
planoczCommented:
You have to use group footers, not table footer.
0
 
DowntownITAuthor Commented:
Say I move it to this format,


Grp_1 Header        =(Fields!Category_Desc.value)   -- groups by Category_Desc

Grp_2 footer        =(Fields!Prod_Desc.value)   =Sum(Fields!sales.value)   =First(Fields!Budget.value)  -- groups by Prod_Desc

Grp_1 Footer                      Totals:                    =Sum(Fields!sales.value)   =Sum(First(Fields!Budget.value))


How would you handle the budget value in the Group 1 footer?



Thanks,
0
 
planoczCommented:
the detail row will be between the grp1 header and grp2 footer should work with the setup you have above
0
 
DowntownITAuthor Commented:
I guess I am not following. It is the grp_1 footer that I am have the issue. The expression =Sum(First(Fields!Budget.value))
 is not working for me.

Thanks
0
 
planoczCommented:
The totals have to be on the last group which is grp2 not grp1
if you want sums for grp1 you will have to add the grp1 footer for those sums.
 
0
 
DowntownITAuthor Commented:
Yes, I do want a sum for grp 1 and my issue is that I can not add up the grp 1 footer for the budget column.
0
 
planoczCommented:
I think you  are wanting...
=First(Fields!Budget.value)  -- Sum(Fields!Prod_Desc.value)
0
 
DowntownITAuthor Commented:
can not sum Fields!Prod_Desc.value, it's only a description field.

=First(Fields!Budget.value) only works at the product level. will not work at the category level.
0
 
DowntownITAuthor Commented:
I actually thought of going this route but was hoping that I could keep the procedure returning all details and doing the grouping at the report, this way I could re-use the procedure for other detailed reports.

Now that you mentioned it, it is not a big deal to have two different versions of the procedure.

Thanks,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.