Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Total not adding up to values in column b/c round

Author  Topic 

rsober
Starting Member

5 Posts

Posted - 2009-05-08 : 12:00:45
I have a matrix where I format the column group to 0 decimal places. I don't want to round in the sql. There are cases where the Add Total is off by 1 because of how it sums the fields and then rounds whereas the numbers in each row are rounded first.

Is there a way to total the column based on the values in the ReportItem versus in the Field?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-08 : 13:29:27
are you applying round function or are you just selecting appropriate format in cell properties?
Go to Top of Page

rsober
Starting Member

5 Posts

Posted - 2009-05-08 : 13:37:41
I am using the formatting function. Everything formats correctly, but one one case, it rounds and then adds whereas the total field adds and then rounds. As you can see from the example below, if the row details are the first 4 rows and you round them, the total is 99, but if you add them up and then round, it is 100.

87.7 88
0.4 0
1.3 1
10.2 10
99.6 99
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-08 : 13:58:23
whats the expression you gave in matrix? also can i assume the total you're speaking is generated by means of standard subtotal column?
Go to Top of Page

rsober
Starting Member

5 Posts

Posted - 2009-05-08 : 14:24:34
The expression for the total is =Sum(Fields!Total_Emissions_CO2e.Value)

I am selecting the row header, right mouse click and select "Add Total" to have it create the total expression. Ideally, I want to add the values in the ReportItem.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-08 : 14:31:51
ok make it like this and try

=IIF(Inscope("Your Column group Name Here "),Sum(Fields!Total_Emissions_CO2e.Value),Sum(Fields!Total_Emissions_CO2e.Value,"Your Column group Name Here"))
Go to Top of Page

rsober
Starting Member

5 Posts

Posted - 2009-05-11 : 14:55:08
I tried putting this expression on the total field but it didn't solve the problem
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-15 : 14:42:38
what happened when you put it? did it gave some error?
Go to Top of Page

rsober
Starting Member

5 Posts

Posted - 2009-05-15 : 15:57:50
It ran but the total still rounded so it didn't equal the total of each row shown
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-16 : 03:54:32
can you remove format function and try putting the relevant format in format properties of cell?
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2009-05-18 : 12:01:14
You could have your SQL query do the rounding for you for your detail lines, thus guaranteeing that the report processor sums the already rounded values and your column then foots properly.

--------------------------------------------
Brand yourself at EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -