Passing SSRS parameter to dataset MDX query

  • Hi,

    I have a simple MDX query:

    SELECT { [Measures].[Amount] } ON COLUMNS, NON EMPTY {(DESCENDANTS([Customer].[Customer Hierarchy].[Level 03].[500107]) * [Date].[Date].[Day].ALLMEMBERS * [As of Date].[As of Date].[As of Date].ALLMEMBERS )} ON ROWS

    I Would like to replace the fixed value 500107 in my MDX statement with parameter that end user gives from report. Is there an easy way to pass parameters to MDX dataset query in SSRS 2008 R2?

    Customer dimension is a parent-child dimension and I want to filter this dimension with parameter from level 03...

  • Hi,

    You can try dynamic query:

    declare @id varchar(10) = '500107'

    EXEC('SELECT { [Measures].[Amount] } ON COLUMNS, NON EMPTY {(DESCENDANTS([Customer].[Customer Hierarchy].[Level 03].[' + @id + ']) * [Date].[Date].[Day].ALLMEMBERS * [As of Date].[As of Date].[As of Date].ALLMEMBERS )} ON ROWS')

    Regards,

    Capzos

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply