views:

942

answers:

1

I have a parent-child attribute relationship in an Analysis services dimension, say [Dim].[Child] is a child of [Dim].[Parent] and I have a query, that returns the set

UNION( [Dim].[Parent].Members * [Dim].[Child].Members, [Dim].[Parent].[ALL] * [Dim].[Child].Members )

on axis 1 and some output on axis 0. The query works fine when run in management studio.

Now I'm trying to make a chart in Reporting Services with [Dim].[Child] on the x axis and Aggregate(some_output) on the Y axis. I expect to see child members on the x axis with the output aggregated for all parents (which is just one in this case), i.e. the data taken from the line { [Dim].[Parent].[ALL], [Dim].[Child].&[TheChildID] } . As stated above, the query does indeed return this line with the correct data.

However, the Aggregate function in this case returns NULL. This behaviour is always present when using parent-child attributes and putting the child on the X axis. The same also happends when putting the child in a tablix row and adding an aggregated output in a column. It seems like the Reporting Server is aware that the aggregation will be happening for only one member and refuses to do it.

If I make another identical query, just put in attributes which have a different relationship, e.g. [Time].[Month] and [Time].[DayOfMonth], aggregation works fine, since this time the same day can belong to many months and data needs to be aggregated.

Now I have no idea why is this happening - does the Reporting Server acctually query the OLAP data source to figure out the relationship or what ? Or is there some magic in the query that returns the ALL rows, which I'm not aware of ? The only correlation for cases which work and which don't seems to be the relationship.

EDIT: some observations after playing around more: the report works if I remove the line [Parent].Members * [Child].Members from the query, forcing it to retrieve only [Parent].ALL * [Child].&[ID] rows. The chart now has data aggregated, but obviously, I don't have individual members anymore.

A: 

Just a couple of observations that I hope will help.

  1. The aggregate function in reporting services requires a "scope" parameter...for example Aggregate(Fields!Child.value, "ParentGroup")
  2. Your data provider must support this function. If it doesn't then "Nothing" is returned. See link below...

For more help/info check Aggregate function documentation.

Mozy
The scope parameter is optional and Analysis services does support the Aggregate function.
Saulius
If you don't specify the scope then it will use the current scope it is in. Are you sure of the current scope and that it is what you want?
Mozy
I'm only doing groupping on the ChildID in the chart, I can't specify anything else in the scope parameter.
Saulius