Greg
Greg

Reputation: 504

How to reference another dataset inside of a table in ssrs?

I have a table that is referencing a dataset called 'InvoiceHeader' and using fields from that dataset. I want to be able to reference another dataset called 'TaxRate' from inside the current table. I'm attempting to do :

= First(Fields!CurrencyDisplay.Value, "TaxRate")

My error is:

The Value expression for the text box ‘textbox5’ refers directly to the field ‘TAXRATE’ without specifying a dataset aggregate

Upvotes: 1

Views: 8023

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21683

You need to use the LOOKUP function.

Without knowing what is in your datasets I can't give a complete answer but I assume there is some common element between the two datasets. Lets assume you have a RegionID in your first dataset and the same ID appears in your seconds dataset called rID (I've used different names for clarity, they may be the same though). In this case your expression would be something like.

=LOOKUP(Fields!RegionID.Value, Fields!rID.Value, Fields!CurrencyDisplay.Value, "DataSet2")

This basically reads...

Using the RegionID field from DataSet1, find the matching value in the rID column in DataSet2 and return the value found in the CurrencyDisplay column.

Upvotes: 6

Related Questions