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
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 SSRS Report Calculation

Author  Topic 

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2012-04-21 : 00:08:34
Hi guys,


I have an SSRS report with several computation.
I have done already the dataset and I already have the ssrs report template with corresponding fields using dataset.lateron the users wanted to have a computation on the report. My question is how to do this computation in SSRS. Do I need to make variable in expression? Need your input guys.

resultset:
ItemID—1—2—-3--4---TOTAL1 --A1—A2—A3—A4—B1—B2—B3—B4—TOTAL2
11111--9-6--4--5-----24------5-3--2---2-4--3--2--3--24

These are the requirements.:
1. The number (1) column is the total of A1 and B1
2. The number(2) column is the total of A2 and B2
3. (3) column is the total of A3 and B3
4. (4) column is the total of A4 and B4
5. TOTAL1 is the total summary of column 1 to 4
6. TOTAL2 is the total summary of A1 up to B4


I tried this in my expression
Do i need this to place in variable?

for column 1
=Sum(Field!A1.Value)+Sum(Field!B1.Value) up to D1
for column 2
=Sum(Field!A2.Value)+Sum(Field!B2.Value) up to D2
and so on...

For the TOTAL1 ??
=Sum(Field!1.Value)+Sum(Field!2.Value)+Sum(Field!3.Value)+Sum(Field!4.Value)


thank you in advance..

jov

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-21 : 12:40:14
are the headers static? ie always from A1 to A4 and B1 to B4? or is it varying based on input?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2012-04-21 : 21:49:58
Hi Visakh16,

thanks for the reply.. yes, the header is static.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-22 : 13:32:06
you can achieve this by applying two column groups. First level group will be a dummy group based on last part of header field (ie 1,2,3,etc). second level group will be the actual header field(A1,A2,...). then add a subtotal to tablix column group and you should get the sum for each group (ie 1 as A1 + B1,2 as A2 + B2,....). One accociated question is whether the order of column in result significant?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2012-04-23 : 23:16:32
Thanks for the reply.
I modified my scripts and applied these calculation instead of doing in SSRS expression. so far its working.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-23 : 23:19:38
ok..thats one way

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -