Using parameters with calculated members
I am developing a report with Report Builder 2.0 and I'm added in some calculated members, these are to show number of records outside a data range. Example1: WITH MEMBER [Measures].[TooLow] AS IIF([Measures].[Percentage Of Records] < 10, [Measures].[Number Of Records], 0) MEMBER [Measures].[TooHigh] AS IIF([Measures].[Percentage Of Records] > 90, [Measures].[Number Of Records], 0) MEMBER [Measures].[RecordsOutOfRange] AS [Measures].[TooLow] + [Measures].[TooHigh] Now the above works fine. However, I need to replace the values with parameters to allow a user defined range. Adding the parameters is no problem. Example2: WITH MEMBER [Measures].[TooLow] AS IIF([Measures].[Percentage Of Records] < @Low, [Measures].[Number Of Records], 0) MEMBER [Measures].[TooHigh] AS IIF([Measures].[Percentage Of Records] > @High, [Measures].[Number Of Records], 0) MEMBER [Measures].[RecordsOutOfRange] AS [Measures].[TooLow] + [Measures].[TooHigh] The above does not work, the Query Designer ignores the values of the parameters. I have checked the contents of the parameters (MEMBER [Measures].[LowValue] AS @Low) and (MEMBER [Measures].[HighValue] AS @High) and combined them to check they are numeric (MEMBER [Measures].[LowHigh] AS [Measures].[LowValue] + [Measures].[HighValue]) and they check out fine. So why is the parameter value ignored in the IIF statement? Anyone help on this? Cheers
July 16th, 2010 11:19am

Hi Markcla, Based on your description, the issue might be caused because of the incorrect parameter Data Type. To solve this issue that the parameter value is ignored in the IIF statement, in the Report Data pane, expand the Parameters folder and right click the @Low parameter and select Parameter properties, in the Parameter Properties window box, verify the Parameter data type is Integer, by default it is Text, which is the reason why the parameter value is ignored in the IIF statement. Repeat the above steps for the @High Parameter to correct its Data Type. thanks, Jerry
Free Windows Admin Tool Kit Click here and download it now
July 20th, 2010 5:05am

Hi, following is my calculated measure which i want to use in my report SUM( LastPeriods( -1 , StrToMember( " [Expiry].[Expiry].[Month].[" + DatePart("YYYY",@ParamDate) + DatePart("MM",@ParamDate) + "].nextmember.nextmember") ,[Measures].[Amount] ) but i am getting following error: The syntax check failed with the following message: 'Parser: The ParamDate parameter could not be resolved because it was referenced in an inner subexpression.' your urgent response will be highly appreciated. thanks in advance.
November 2nd, 2010 11:08pm

I posted an article on this error http://gauravsqlserver.blogspot.com/2011/03/parameter-could-not-be-resolved-because.html Please have a look and hope this helps. Thanks, Gaurav http://gauravsqlserver.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2011 3:57pm

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

Other recent topics Other recent topics