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() ...
Get MDX with Microsoft SQL Server 2016 Analysis Services Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.