SQL Server Reporting Services - Expression Scope problem in Charts
Hello,
I' m getting the following error :
Error 1 [rsInvalidAggregateScope] The Y expression for the chart ‘Chart1’ 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 the name of a dataset.
I'm just trying to write the following Expression while configuring Series Value field :
=Sum(Fields!01_100.Value,"RootCode")
The 'RootCode' is a field of current DataSet.
This error occurs only for the charts, for the tables this expression works fine...
Why is 'RootCode' out of Scope, how can be solved this problem?
Thanks
September 3rd, 2011 11:16am
Dont know if I have got you fully, but check in manual, and also check on
this link for a flash demo on using the Chart oject.
Free Windows Admin Tool Kit Click here and download it now
September 4th, 2011 1:24am
Hi TAM-UNA,
That is because, in Reporting Services, the Scope parameter in Sum(Expression, Scope) function must be The name of a dataset, grouping, or data
region that contains the report items to which to apply the aggregate function.
Since
RootCode is just one field in the dataset, the chart cannot recognize it as a group name, it will give [rsInvalidAggregateScope] error.
Generally, you need add the Name field to the category fields drop zone to automatically generate a group, with the same name as that of the field.
Then, when you add the Sales field to the data fields drop zone, the text of the data field appears in the legend, and the data from this numeric field will be aggregated into one value. By default, the value is aggregated using the
built-in function Sum. You should not add the group scope in the sum function, it will aggregate based on intellisense group.
More details about Adding Data to a Chart Data Region, please see:
http://msdn.microsoft.com/en-us/library/cc627495(v=SQL.100).aspx
Thanks,
Lola
Please remember to mark the replies as answers if they help.
September 7th, 2011 5:11am
Hello ,
Thanks for your reply, it was quite informative for me; but actually I was trying to do something like that :
=Avg(Avg(Avg(Fields!01_100.Value, "PositionID"), "PositionGroupID"), "RootCode")
This works for Table , but unfortunately doesn't work for Charts , because
" You should not add the group scope in the sum function, it will aggregate based on intellisense group."
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2011 2:31pm
Hi TAM-UNA,
I suggest you to accomplish the complex calculation on dataset query statement. And then, we will be able to display the results with chart, as well as optimize the Report peformance.
The query statement might as:
select RootCode, avg(average2) as average
From
(select RootCode,PositionGroupID,avg(average1) as average2
from
(select RootCode,PositionGroupID,PositionID,avg(01_100) as average1
from <tableName>
group by PositionID,PositionGroupID,RootCode) as temp1
group by PositionGroupID,RootCode) as temp2
group by RootCode
Thanks,
Lola
Please remember to mark the replies as answers if they help.
September 9th, 2011 6:30am