• No special SSRS expression is required, just a marginally more complex T-SQL WHERE clause that has separate conditions for each value of @enrollmentType. The WHERE clause would be something like this:

    WHERE

    (@enrollmentType = 'New Enrollment' AND

    enrollmentDate BETWEEN @startDate AND @endDate)

    OR

    (@enrollmentType = 'Total Enrollment' AND

    enrollmentDate <= @endDate AND

    COALESCE(exitDate, @startDate) >= @startDate)

    This use of the BETWEEN comparison assumes (as does your original example) that all the dates occur at midnight if they are datetime data types. If the time value is recorded for enrollmentDate, then a more complex comparison is required. The COALESCE command substitutes the @startDate value whenever exitDate is null, thereby simplifying the overall WHERE clause.