2
votes

If I have a simple MDX query such as:

 SELECT 
 NON EMPTY { [Measures].[Amount] } ON COLUMNS, 
 NON EMPTY {  [Date].[Date].[Date]  } 
 ON ROWS FROM [MyCube] 

And I want to filter it by an Id an another dimension this is easy enough.

 SELECT 
 NON EMPTY { [Measures].[Amount] } ON COLUMNS, 
 NON EMPTY {  [Date].[Date].[Date]  } 
 ON ROWS FROM [MyCube] 
WHERE (Asset].[Id].&[123])

but If I have multiple Id's is there any way to pass these in without dynamically building up the MDX query?

2

2 Answers

3
votes

Try this:

SELECT
    NON EMPTY { [Measures].[Amount] } ON COLUMNS,
    NON EMPTY { [Date].[Date].[Date] } ON ROWS
FROM [MyCube]
WHERE (
   { [Asset].[Id].&[123],[Asset].[Id].&[124]}
)
2
votes

I'm not 100% sure about what you mean about not dynamically building up the MDX query, but the form of the query that you want is this:

SELECT
    NON EMPTY { [Measures].[Amount] } ON COLUMNS,
    NON EMPTY { [Date].[Date].[Date] } ON ROWS
FROM [MyCube]
WHERE (
    [Asset].[Id].&[123],
    [OtherDim].[Foo].&[3919]
)

...so I suppose that would need some dynamic building, but nothing too stressful.