# Calculate values from two different tables in custom report?

• ### Question

• Hi,

I have created a custom report in visual studio 2008 which have two different tables in it. I would like to have a textbox that calculate the total from both tables.

Example:

Table 1
No.     amount
1.       100
2.       50
3.       25
Tot.    175

Table 2
No.     amount
1.       100
2.       25
Tot.    125

Textbox value = (table 1 total + table 2 total) 175 + 125

How do I make that expression in the textbox?

Wednesday, July 28, 2010 9:45 AM

• Try This

=Cint(ReportItems!Textbox29.Value  )+Cint(Reportitems!Textbox30.Value)

• Marked as answer by Monday, August 9, 2010 8:56 AM
Tuesday, August 3, 2010 5:00 AM

### All replies

• Try this

=sum(Fields!table1total .Value,Fields!table2total .Value)

Mahain
Wednesday, July 28, 2010 9:52 AM
• Hi,

But what do I write instead of table1total and table2total?

The total fields are calculated "sum fields", and not fields from the dataset.

The total fields name is "textbox29" and "textbox30", and the value in the both are "[Sum(Fields!Amount.Value").

/Marinfloc

Wednesday, July 28, 2010 10:38 AM
• you need to replace it with textbox name like

try

=sum(Fields!textbox29.Value,Fields!textbox30.Value)

Mahain
Wednesday, July 28, 2010 10:45 AM
• I tried it and it does not work.

Recieved the following error:

"The Value expression for the textrun 'Textbox47.Paragraphs[0].TextRuns[0]' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or a name of a dataset"

Wednesday, July 28, 2010 10:58 AM
• Hi,

It should work

=Sum(Fields!textbox29.Value+Fields!textbox30.Value)

Mahain
Wednesday, July 28, 2010 11:16 AM
• Hi,I have tried it several times whitout succes.

I just want to clarify somethings regarding this.

=Sum(Fields!textbox29.Value+Fields!textbox30.Value)

Textbox29 is not data from the dataset, it is a "total" field from my table.

The same for the Textbox30.

The data in these textboxes goes like this [sum(SEK)].

But I wil try to create a new project to see if my current  project have some problems or something. Will come back later...

/MArinfloc

Saturday, July 31, 2010 10:54 AM
• Try This

=Cint(ReportItems!Textbox29.Value  )+Cint(Reportitems!Textbox30.Value)

• Marked as answer by Monday, August 9, 2010 8:56 AM
Tuesday, August 3, 2010 5:00 AM
• Hi,

Works perfect!

Thank you!!

Monday, August 9, 2010 8:56 AM