Problems with my WHERE claus in MDX query
My basic query to populate a parameter list for a report: WITH MEMBER [Measures].[ParameterCaption] AS '[Outside Rep].[Rep].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Outside Rep].[Rep].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Outside Rep].[Rep].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Outside Rep].[Rep].ALLMEMBERS ON ROWS FROM [Heidtman DW] WHERE {[Outside Rep].[Deleted].[False], [Outside Rep].[ManagerYN].[False]} If I change the {} brackets in the WHERE to (), the query runs but takes 50 times longer and returns all nulls. I'm not sure what that's all about but it's not my main problem. The problem comes when I try to add a division parameter to the WHERE clause: WHERE ([Outside Rep].[Deleted].[False], [Outside Rep].[ManagerYN].[False],IIF( STRTOSET(@Division, CONSTRAINED).Count = 1, STRTOSET(@Division, CONSTRAINED), [Organization].[Division].currentmember ) ) or WHERE {[Outside Rep].[Deleted].[False], [Outside Rep].[ManagerYN].[False],IIF( STRTOSET(@Division, CONSTRAINED).Count = 1, STRTOSET(@Division, CONSTRAINED), [Organization].[Division].currentmember ) } The first takes forever to process and returns all nulls while the second - with {} - returns the error: Query (2,1) Two sets specified in the function have different dimensionality. How can I add the Division parameter to the WHERE clause? Thanks.
November 30th, 2010 3:55pm

Hi John, Change the where clause like this: WHERE ({[Outside Rep].[Deleted].[False], [Outside Rep].[ManagerYN].[False]}, IIF( STRTOSET(@Division, CONSTRAINED).Count = 1, STRTOSET(@Division, CONSTRAINED), [Organization].[Division].currentmember )) thanks, Jerry
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2010 1:56am

I think you can simply write as shown below also WHERE ({[Outside Rep].[Deleted].[False]}, {[Outside Rep].[ManagerYN].[False]},strtoset(@Division)) Cheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
December 1st, 2010 6:11am

I have Five parameters in this report with five different queries to populate each parameter list. Division is a separate query from OutsideRep. Each parameter is given a non-queried default value in the Report Parameters screen. 1. I add Division as a parameter to the OutsideRep query (and not the WHERE clause just to test). The report runs fine - with no change in the OutisdeRep parameter list. 2. I add the WHERE clause you suggested and two things happen, well only one thing really: The report runs but now the Division parameter is no longer preset - it comes up missing. I can choose a division from the parameter list in the report and the report will run but it does NOT seem as if the OutsideRep parameter list is at all changed by selecting different divisions. So while the report seems to run, it is not running correctly. Edit: Probably because I don't have a division attribute in dimOutsideRep...I'm fixing that right now...will report back...
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2010 7:26am

Can you paste the entire query here that you used to check and tell us what is the issue? Cheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
December 1st, 2010 8:34am

As noted above, I didn't have a relationship/attribute to division in dimOutsideRep. I'm working on that right now... D'OH
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2010 8:41am

OK. Here's where it gets complicated. The company that I'm writing this for has several divisions. It is possible for different divisions to have different fiscal start dates. To compute the correct date range for any given division I concantenate a month number to the end of each division's parameter value. There's actually a hidden ASCI character between the double quotes that custom code looks for - keying on the next character as the month value. Query for @Divsision parameter: WITH MEMBER [Measures].[ParameterCaption] AS '[Organization].[Division].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Organization].[Division].CURRENTMEMBER.UNIQUENAME + " " +[Organization].[Fiscal Start].CURRENTMEMBER.Item(0).Name' MEMBER [Measures].[ParameterLevel] AS '[Organization].[Division].CURRENTMEMBER.LEVEL.ORDINAL' MEMBER [Measures].[Fiscal Start] AS '[Organization].[Fiscal Start].CURRENTMEMBER.Item(0).Name'SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel],[Measures].[Fiscal Start]} ON COLUMNS , [Organization].[Division].ALLMEMBERS ON ROWSFROM [Heidtman DW]WHERE [Organization].[Deleted].[False] I've added the Division attribute to my dimOutsideRep table but I'm not sure I can even use it without the concantenation. As far as I can tell you can only use two things from a report parameter, the parameter caption and the parameter value. Query for @OutsideRep query: WITH MEMBER [Measures].[ParameterCaption] AS '[Outside Rep].[Rep].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Outside Rep].[Rep].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Outside Rep].[Rep].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Outside Rep].[Rep].ALLMEMBERS ON ROWS FROM [Heidtman DW] WHERE({[Outside Rep].[Deleted].[False], [Outside Rep].[ManagerYN].[False]}, IIF( STRTOSET(@Division, CONSTRAINED).Count = 1, STRTOSET(@Division, CONSTRAINED), [Organization].[Division].currentmember )) I'm getting similar results...when I run the report the @Division paremeter is no longer initialized. Excpet now when I choose a Division parameter from the drop down list I get an error message: Query execution failed for data set 'OutsideRep'. Parser: The following syntax error occurred during parsing: Invalid token, Line 1, Offset 60, k%. I can run the OutsideRep query under the data tab with no problem.
December 1st, 2010 8:42am

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

Other recent topics Other recent topics