Passing parameters to an MDX query
In this recipe, we will consider two questions when passing parameters to an MDX query. One is the location of the parameters in the query, and the other is when to use STRTOMEMBER()
function and when to use STRTOSET()
function.
Where should we put the parameter(s) in the MDX query? We actually have the freedom to put them anywhere - in the WITH
clause, on the COLUMNS
and ROWS
axes, in the WHERE
clause, and in the subquery. In the previous recipe, Using a date calendar, we decided to put the parameters in the sub-query. In this recipe, we are going to expand that MDX query and add one more parameter on the ROWS
axis. We will also move the date member parameter from the subquery to the WHERE
clause.
The STRTOSET()
function works in the same way as the STRTOMEMBER()
function. The only difference is that the STRTOSET()
function resolves the string into a set, while the STRTOSET()
function resolves the string into a member. In this recipe, we will use both of...