0

Updating report parameters based on parameter selection? (SSRS)

the above seems to be applicable on list based parameters.

But how do we apply for Dates: say the requirement will be

if i create a list parameters for This day,This week,This month etc. the Start date should change based on earlier selections.

How do we acheive this?

Community
  • 1
  • 1

1 Answers1

0

You can set your list parameter to be of type integer, then set available values to be: Available Values

Then in your date parameter, set the default value to be along the lines of:

=switch(Parameters!ReportType.Value = 1, dateadd(dateinterval.day, -1, Today()), Parameters!ReportType.Value = 2, DateAdd(DateInterval.Day, 2-WeekDay(Today()), DateAdd(DateInterval.Day, -7, Today())), 1=1, dateadd(dateinterval.day, -1, Today()))

This checks the value of the previous parameter and sets the default start date based on that (weekly or daily). The final condition in the switch is 1=1 - this is always true, so is the equivalent to an else condition. It's not required, I just like it in case something weird happens and they manage to get there.

Note If you select one of the values from the first parameter (e.g. "Daily") and the default values for the date parameter(s) change, changing the first parameter to "Weekly" will not update the date parameter. This is a known issue with cascading parameters - the only way to change them at that point is to either do it manually or refresh the report.

BishNaboB
  • 1,047
  • 1
  • 12
  • 25