adding, removing, modifying named sets

Hi,

I have two questions.

First on is like in the title. Is it possible to add, remove or modify a named set in an already deployed cube? I don't want to modify anything except the sets. If it is possible at all, are there any example of doing it?

Second is technical. I have redefined set "myRowsSet" to "myRowsSet2". What I did is I removed the calculated members and placed their code directly inside the set. Why isn't it working?

with
-- road bikes in france
member [Product].[Product Line].myMemberRoad as aggregate(
	existing(
		intersect(
			[Product].[Product Line].[Product Line].members
			,[Product].[Product Line].&[R]    -- road
		)
	)
)
-- accessories in canada
member [Product].[Product Line].myMemberAccessories as 
aggregate(
	existing(
		intersect(
			[Product].[Product Line].[Product Line].members
			,[Product].[Product Line].&[S]    -- accessory
		)
	)
)
-- two members aggregated
set myRowsSet as 
       {myMemberRoad, myMemberAccessories}
set myRowsSet2 as {
		aggregate(
			existing(
				intersect(
					[Product].[Product Line].[Product Line].members
					,[Product].[Product Line].&[R]    -- road
				)
			)
		)
		,aggregate(
			existing(
				intersect(
					[Product].[Product Line].[Product Line].members
					,[Product].[Product Line].&[S]    -- accessory
				)
			)
		)
	
}

select 
{[Measures].[Internet Gross Profit]} on 0
,NON EMPTY {myRowsSet, myRowsSet2, [Product].[Product Line].[All Products].children} on 1
from
[Adventure Works]


May 25th, 2015 9:05am

First on is like in the title. Is it possible to add, remove or modify a named set in an already deployed cube? I don't want to modify anything except the sets. If it is possible at all, are there any example of doing it?

You can't deploy just a single set definition, but you can redeploy just the MDX Script (which contains everything in the calculations tab. The easiest way to do this is to use the "Deploy MDX Script" feature in BIDS Helper http://bidshelper.codeplex.com. 

Second is technical. I have redefined set "myRowsSet" to "myRowsSet2". What I did is I removed the calculated members and placed their code directly inside the set. Why isn't it working?

You should have gotten a pretty clear error message about myRowSet2 although there are 2 major errors with myRowsSet2:

1. Aggregate returns a numeric expression not a set, so you can't assign the result from the aggregate() function to a set (you need to assign a set expression to a named set).

2. The Aggregate() function itself expects 2 parameters, a set to aggregate across and a numeric expression to be calculated for each member of that set, you've tried to pass it two numeric expressions.

Given the above I'm not even sure what the outcome is you were trying to achieve. Even myRowsSet looks like it actually does nothing, you are intersecting a member with the set it came from which will return just the member itself. The whole query could be re-written like the following:

WITH SET mySet3 as 
  {[Product].[Product Line].&[S]
   ,[Product].[Product Line].&[R]}
select 
{[Measures].[Internet Gross Profit]} on 0
,NON EMPTY mySet3 on 1
from
[Adventure Works]

I'm assuming that you've had to translate this issue from your own cube into AdventureWorks and something's gotten lost in the translation.

If what you are trying to do is more along the lines of the first set. ie. returning 2 amounts, both of which are derived by doing an aggregation over some complex set expression, then there is no way to create this with just a single set expression. You have to create the two measures first, then put them in the named set.

If you are trying to return a single amount over both expressions we should be able to do that, but that would be a calculated member, not a set.

Free Windows Admin Tool Kit Click here and download it now
May 25th, 2015 11:07pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics