Sql Server 2008 Reporting Services: Using two dataset error

aggregate-functionssql-server-2008ssrs-2008

Im building a report that's using two datasets. when I preview I find these types of errors…

Error 19
[rsFieldReferenceAmbiguous]
The Value expression for the text box ‘Textbox3’ refers directly to the field ‘PerZipCode’ without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.

What aggregate function is needed and where is there an option to set this?

Best Answer

If you are adding multiple datasets to a report, the above may not fix your problem. You may just get the following error when you aggregate it:

[rsMissingAggregateScope] The Value expression for the text box ‘textbox6’ uses an aggregate expression without a scope. A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset.

What you may need is something like :

First(Fields!MyField.Value, "DATASETNAME")

Which you can get by using the Expression Builder, rather than the drag and drop of fields from the dataset.