Partial re-use of a MDX query?
is it possible to define a MDX query within a report, and then re-use it a bunch of times, but each time with different WHERE section. i.e. the Members and SELECT section would be the same for each row (MTD.Count YTD.Count) but, i'd want to filter it 10 different ways.. The only way i can think of doing this right now, is adding 10 datasets, each with a different WHERE section, but i'd like to re-use just one DS
July 7th, 2011 11:19am

Hi Squarewave24, It is possible to create such stuffs. Do as follow Main Query is set of common data. With Set Main_query AS ( NONEMPTY(Except( [Dimension].[Field].[Field], { Common Condition} ) * NONEMPTY( Except( [Dimension].[Field].[Field], [Field].[Field]) * NONEMPTY([Dimension].[Field].[Field] , (STRTOSET(@Parameter, CONSTRAINED) )) , Except([Dimension].[Field].[Field] , {condition} ) ) ) ) *Use filter as below Set Filter1 AS existing ( Filter ( { Main_query } , (Apply your criterial ) Set Filter2 AS existing ( Filter ( { Main_query } , (Apply your criterial ) SELECT NON EMPTY { [Measures].[K]} ON COLUMNS, Non Empty{ union(Filter1,filter2) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [Cube Name])))))))) Amit Please mark as answer if useful
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2011 1:41pm

hi, thanks, but how would i use these different filters? if say i want to use the same query in a different textbox but with a different filter?
July 8th, 2011 3:08pm

subreports saved me here.. My actual goal was to repeat the same MDX query with a different WHERE section of the query for each row. Sub reports are design for just that. You can define a matrix and bind it to a dataset. That dataset will determine how many rows of data your matrix will be populated it. You can embed a subreport in a cell of your matrix, and pass it a parameter (in my case i am passing the whole WHERE filter, but you could make it more granular and only pass a field. here are some more links SubReports dynamic queries/parameters
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 10:16am

Great, thank you for sharing your solutions and experience here. It will be very beneficial for other community members who have similar questions.Please remember to mark the replies as answers if they help and unmark them if they provide no help.
July 13th, 2011 9:44pm

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

Other recent topics Other recent topics