Skip to content
Advertisement

Hide null values on parameter value

I have a stored parameter with a where clause between start and end dates that includes null values:

WHERE a.date is null OR a.date between @StartDate AND @EndDate

These null values are obviously being selected when any parameter value (date range) is chosen in my SSRS report…. my question is, is there a way to not show these null values when a specific parameter value (date range) is selected?

P.S. I can hide the row where parameter equals a value and the a.date field is null in Row Visibility within a SSRS report but I want to avoid this if possible.

Thanks in advance!

Advertisement

Answer

You can extend the filtering conditions:

WHERE a.date is null AND (@startDate is NOT NULL OR @EndDate IS NOT NULL) OR
      a.date between @StartDate AND @EndDate
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement