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
 calculating two colums

Author  Topic 

LarryDC
Starting Member

6 Posts

Posted - 2013-06-13 : 21:53:47
hello,

I have built a report using the matrix wizard

on the left I have a name the columns are created based on date and I am doing a count on a number field.

example:


names 2013 2012

name1 500 400
name2 100 300
name3 100 100


what I want to do is calculate the difference between the 2013 and 2012 column but this seems impossible. The table would look like this:


names 2013 2012 Difference

name1 500 400 100
name2 100 300 (200)
name3 100 100 0


how can I calculate the 2013 and 2012 column in report builder? there is only one field that I put in the column groups which groups the column into year.

Any help would be appreciated.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-14 : 01:27:59
Put a subtotal row and write an expression like

=IIF(Inscope("columngroup"),Yourcurrentcountexpression,COUNT(IIF(Fields!datefield.value=Year(Now()),Yourcurrentcountexpression,Nothing))-COUNT(IIF(Fields!datefield.value=Year(Now())-1,Yourcurrentcountexpression,Nothing)))

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -