I am making an ssrs report in vs2008,sql2008 and everytime I try to preview I get the following error.
"The value expression for the texbox 'Textbox37' refers directly to the field 'AvgRate' without specifying a dataset aggregate.
When the report contains multiple datasets, field references outside of a data region must be contained outside of a data region must be contained within aggregate functions which specify a dataset scope."
I think problem arises as a result of having two datasets in the report the code which is giving the error is here below:
=iif(Sum(Fields!CostData.Value)-Sum(Fields!Data.Value)>0,0,
(Sum(Fields!Data.Value)-Sum(Fields!CostData.Value))*Fields!AvgRate.Value)