Parameters: modify expression for default values
Hi, I'm creating a report in report builder with a parameters to select the years you want to work with. As default years I have selected 2010 and 2011. In the parameters properties window, tab default, "specify values" is selected and in the value box I see the following expressions: [DimTime].[Year].&[2010-01-01T00:00:00] [DimTime].[Year].&[2011-01-01T00:00:00] Is there a way to replace "2010" in this expression by the previous year (formula= year(today())-1) and "2011" by the current year (formula= year(today()))? I've tried something like this: [DimTime].[Year].&[ & year(today()) & -01-01T00:00:00] but it doesn't work... Thanks, Vanessa
June 24th, 2011 10:24am

The following article deals with dynamic MDX: http://sqlblog.com/blogs/stacia_misner/archive/2010/10/07/29231.aspx Kalman Toth, SQL Server & Business Intelligence Training; SQL 2008 Grand Slam
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2011 11:33am

Hi Nes1205, The issue here is caused by incorrect expression format. When we combine static text with an expression result, we need enclose the static text in double quotes and use an ampersand (&) as a concatenation operator. There is also a need to convert other data type value to a string using the CStr function to concatenate it with a string. So, to meet the requirement, we can specify the default value by the expression like following: ="[DimTime].[Year].&[" & CStr(Year(Today())-1) & " -01-01T00:00:00] " ="[DimTime].[Year].&[" & CStr(Year(Today())) & " -01-01T00:00:00] " Thanks, Lola WangPlease remember to mark the replies as answers if they help.
July 3rd, 2011 1:34am

Works perfectly! Thanks!
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 2:41am

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

Other recent topics Other recent topics