Search code examples
mdxiccube

creation of a set on measures raises an error in icCube


In schema Sales, I create a set which gives result if it is defined within the scope of a statement. The following code is in the MDX IDE:

with set [facts] as {[Measures].[Amount], [Measures].[Count]}
select [facts] on 0
from sales

This gives the measures Amount and Count perfectly as result

If I define the same set on the session level, or in the Builder (tab: advanced) it raises an error.

To reproduce, do the following in the MDX iDE:

create static set [facts-2] as {[Measures].[Amount], [Measures].[Count]}

and then type:

select [facts-2] on 0
from sales

The MDX IDE gives as error:

set( [facts-2] ) : '[Measures].[Amount]' is neither a dimension nor a hierarchy within the cube.

Am I doing something illegal here or is this a bug?


Solution

  • You need to add the cube when creating the set. In this particular scenario is not usefull, but it's needed when there is an evaluation to define the evaluation scope.

    So :

    create static set [sales].[facts-2] as {[Measures].[Amount], [Measures].[Count]}
    

    Yes, error is not very helpfull