Showing posts with label sum. Show all posts
Showing posts with label sum. Show all posts

Thursday, March 8, 2012

Creating Report Server 2005 Report Totals

I have a table in my report. In it, I have 2 headers, a group and 1 footer at the bottom.

How do I sum my columns in the footer?

so nobody has tried adding totals in a table before or what?|||Uhm. Why don't you try
=sum(Fields!MyFieldToSum.Value)
typed in the footer field? Or do I miss something here?

Wednesday, March 7, 2012

Creating Parent/Child table with Sum for each group

Hi,
i've been working on this report for the whole day now and have come
to the conclusion that this can't be accieved with Reporting Services
SP1.
Or maybe i'm wrong...
I'm trying to display a report like this:
-- Group 1
-- SubGroup 1,1
-- SubGroup 1,2
-- SubGroup 1,3
-- SubSubGroup 3,1
-- SubSubSubGroup 3,1,1
-- Totals for SubSubSubGroup 3,1,1
-- Total for SubSubGroup 3,1
-- Totals for SubGroup 1,3
-- Total for Group 1
My data looks like this:
Text, Amount, Group, ParentGroup
I have done it like described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_structure_objects_v1_3cok.asp
The problem is getting the Total to display correctly. I have tried
adding a table footer but this will only display the Total for the
entire table and not for each group.
Anybody know a solution to making this kind of report?
-MartinI had a similar problem. In the end I got around the problem by
creating a query that returned the hierarchised sub totals in the
dataset...this is relatively easy if your datasource is OLAP -
admittedly not so ideal if you are using relational datasources ...|||I found a way to work around it, and almost getting the desired result.
The result looks like this:
-- Group # 1, Total Amount
-- SubGroup # 1.1, Total Amount
-- SubGroup # 1.1.1, Total Amount
-- Element # 1.1.1.1, Amount
-- Element # 1.1.1.2, Amount
-- SubGroup # 1.1.2, Total Amount
-- Element # 1.1.2.1, Amount
I have added a Columns, "Headline", which tells me if a Row is a group
or an Element.
Then when i want the Amount displayed i use this expression:
=IIF(Fields!Headline.Value = 0, Fields!Amount.Value,
(Sum(Fields!Amount.Value, "table2_Details_Group", recursive)))
This seems to be the only way to calculate the Totals for a recursive
table...
-Martin

Sunday, February 19, 2012

Creating Group Eliminates Records

Forgive the novice nature of this question.

I have a report that I want to create four groups for. Prior to grouping, I've created a Sum for an amount field. I get a Total of $1000.00 (for simplicity sake I'm making up a number).

I create the first grouping and subtotal that group. No problem
I repeat for the second and third grouping. No problem.

However, on the final grouping, it changes my Grand Total to $988.50. I assume this means that records are being eliminated? The final grouping is different than groups 1, 2, and 3 in that it is in a different table. Does this have anything to do with it.

Your help is greatly appreciated.What type of join do you use when joining this table?
Inner or Left Outer?|||I've been taught to just click the smart button on the join screen. So I accepted what Crystal mapped.

It's set to an inner join. I changed it and it worked! Thank you so much.

Is there anyway that you can tell me in layman's terms why I needed to do that? What is the difference between those types of joins?

Also, do the joins get saved with the report, or do I need to set them each time I refresh the report with new data?

Thank you again!|||:) Yes, of course the joins get saved with the report.

I don't think I can give you better explanations then those you have in the 'Help' file.
Read help on 'inner join' and 'left outer join'.

Actually, here is one example of how it works, let's say we have 2 tables.
The 1st one is accounts:

acc_num acc_name state
-----------
acc1 name1 MN
acc2 name2 NJ
acc3 name3 NY
acc4 name4 OH
acc5 name5 AK

and the 2nd one is payments:

acc_num pay_date amount
------------
acc1 6/1/07 $30.00
acc3 7/4/07 $100.00
acc5 7/15/07 $40.00

If you use inner type of join to link them (accounts.acc_num=payments.acc_num), the result will be next:

acc_num acc_name state pay_date amount
--------------------
acc1 name1 MN 6/1/07 $30.00
acc3 name3 NY 7/4/07 $100.00
acc5 name5 AK 7/15/07 $40.00

2 records from the 1st table (acc2, acc4) are not selected because there are no such field values in the 2nd table.

But if you use left outer join, you will get all of the records from the primary (left) table:

acc_num acc_name state pay_date amount
--------------------
acc1 name1 MN 6/1/07 $30.00
acc2 name2 NJ
acc3 name3 NY 7/4/07 $100.00
acc4 name4 OH
acc5 name5 AK 7/15/07 $40.00

...probably, your smart button didn't get what you were trying to do ;)
but to be serious, I wouldn't use it. :)|||Duh, the help file. That was, helpful.

In all seriousness, thank you so much for your help.