I'm new to MDX. Now I want to combine two results from 2 different dimensions. I'm using codes as following:
With
MEMBER [Measures].[Student Head Count].[Program1] AS
([Program1].[Program1].&[1])
MEMBER [Measures].[Student Head Count].[Program2] AS
([Program2].[Program2].&[1])
SELECT
NON EMPTY
{
[Measures].[Student Head Count].[Program1] ,
[Measures].[Student Head Count].[Program2]
}
ON COLUMNS
FROM [Current Student Overview]
The error shows:
The Program1 calculated member cannot be created because its parent is at the lowest level in the Measures hierarchy.
I know that “Student Head Count" is at the lowest level, but I don't know how to modify the syntax. If I replace “Student Head Count" with "Test" , it's not working either. Also, "Union" does not work as I tried. Could anyone help me with modified or new MDX?
I tried with Crossjoin with following script:
SELECT
NON EMPTY
{
[Measures].[Student Head Count]
}
ON COLUMNS,
NON EMPTY
{
NONEMPTYCROSSJOIN({[Program1].[Program1].&[1]},{[Program2].[Program2] }),
NONEMPTYCROSSJOIN({[Program1].[Program1] },{[Program2].[Program2].&[1]})
}
on 1
FROM [Current Student Overview]
THe result is:
How could I eliminate or hide the "All" column in performancepoint then?
There is only one level on the Measure dimension. Your measure name should be be [Measures].[Program21]
and [Measures].[Program2]
.
You can also rewrite your query like this:
SELECT
NON EMPTY
{
([Program1].[Program1].&[1], [Program2].[Program2].&[1])
}
ON COLUMNS
FROM [Current Student Overview]
WHERE ([Measures].[Student Head Count])
In Mdx you cannot union results from different dimensions but you can do the cross product with the CrossJoin function.
EDIT:
You do not need to use CrossJoin when you have only one member in your sets. You can do (member1, member2)
.
If you do not want to see All
you can use a query like this one:
WITH
MEMBER [Measures].[Student Head Count Program1] AS
([Measures].[Student Head Count], [Program1].[Program1].&[1], [Program2].[Program2].[All])
MEMBER [Measures].[Student Head Count Program2] AS
([Measures].[Student Head Count], [Program1].[Program1].[All], [Program2].[Program2].&[1])
SELECT
NON EMPTY
{
[Measures].[Student Head Count Program1] ,
[Measures].[Student Head Count Program2]
}
ON COLUMNS
FROM [Current Student Overview]