Adding parameter to mdx in ssrs
Hello, I have the follwong mdx: SELECT NON EMPTY { [Measures].[Sales] } ON COLUMNS, NON EMPTY { ([Dim Date].[Date Hierarchy].[Month].ALLMEMBERS ) } ON ROWS FROM ( SELECT ( { [Dim Product].[Level 5].&[Milk] } ) ON COLUMNS, filter ( [Dim Product].[Level Hierarchy].members, ( [Dim Product].[ID].currentmember.Properties("Quantity Per Item")='1' and [Dim Product].[Product ID].currentmember.Properties("Unit Of Measurement")='Liters' ) ) on rows I want the user to pass values so as to select the months to be shown so in the following line: NON EMPTY { ([Dim Date].[Date Hierarchy].[Month].ALLMEMBERS ) } ON ROWS I guess i have to put somehting like between @start_date and @end_date . How should i write the line with the parameters? Thnaks in advance, Andreas
May 6th, 2012 4:42pm

Hi There When you are selecting your query from SSAS for your report , at that time you could add parmeter inside your report as shown in figure I hope this will help Many thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
May 6th, 2012 8:21pm

Hello, Thnaks for your answer. Though i need to do this using mdx, not the interface. Thnaks, ANdreas
May 7th, 2012 9:36am

Hello, I tried to write the following mdx: SELECT NON EMPTY { [Measures].[Sales] } ON COLUMNS, NON EMPTY { ([Dim Date].[Date Hierarchy].[Month].ALLMEMBERS ) } ON ROWS FROM [Cube] WHERE [Dim Date].[Date Hierarchy].[Month].&[January 2010]:[Dim Date].[Date Hierarchy].[Month].&[January 2011] But i get the message that the Date Hierarchy already appears in the x axis. Any ideas? If that mdx worked i could pass the Month names to the mdx through a parameter where the parameter available values could originatefrom the following mdx: select {} on 0, [Dim Date].[Date Hierarchy].[Month] on 1 from [Cube] ANy ideas about the mdx with the where clause? Thnaks in advance, Andreas
Free Windows Admin Tool Kit Click here and download it now
May 7th, 2012 10:07am

Hello, I tried the following mdx and it partially works. SELECT NON EMPTY { [Measures].[Sales] } ON COLUMNS, NON EMPTY { [Dim Date].[Date Hierarchy].[Month].&[January 2010]:[Dim Date].[Date Hierarchy].[Month].&[January 2011]} ON ROWS FROM [Cube] I have embedded this mdx in a data set is reproting services. Now i want to replace the Month values (&[January 2010] and &[January 2011]) with parameters e.g. From and To. How can i do that? I tried the follwong, after having defined the parameters from the parameters buttin at the query designer but no luck: SELECT NON EMPTY { [Measures].[Sales] } ON COLUMNS, NON EMPTY { [Dim Date].[Date Hierarchy].[Month].&@From:[Dim Date].[Date Hierarchy].[Month].&@To} ON ROWS FROM [Cube] I get the error meassage: TITLE: Microsoft Visual Studio ------------------------------ Query preparation failed. ------------------------------ ADDITIONAL INFORMATION: Failed to parse the query to detect if it is MDX or DMX. Error: 'Query (2, 50) Parser: The syntax for '@From' is incorrect.' (MDXQueryGenerator) ------------------------------ BUTTONS: OK ------------------------------ The parameters are defined as follows: Any ideas? Thnaks in advance, ANdreas
May 7th, 2012 10:27am

Hello, I also theied the following: SELECT NON EMPTY { [Measures].[Sales] } ON COLUMNS, NON EMPTY { [Dim Date].[Date Hierarchy].[Month].[" & Parameters!From.Value & "] :[Dim Date].[Date Hierarchy].[Month].[" & Parameters!To.Value & "] } ON ROWS FROM [Cube] I don;t get any error messages but when i run the query i get nothing as the result (althogh the execution is successfull). ANy ideas? Thanks, ANdreas
Free Windows Admin Tool Kit Click here and download it now
May 7th, 2012 1:14pm

Hello, I found the solution. The strtomember was used: SELECT NON EMPTY { [Measures].[] } ON COLUMNS, NON EMPTY { ([].[].[].ALLMEMBERS ) } ON ROWS FROM ( select { ( strtomember(@StartYear):strtomember(@EndYear) ) } ON columns from [Cube] ) Thnaks, Andreas
June 3rd, 2012 4:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics