SSRS 2005 Table Filter, getting last 3 years

  • have a table in a report that I need to only print if MyDate is within the last 3 years. I have tried several things and I either get all dates or none.

    I have tried the following that returns no dates:

    Table Properties, Filters

    Expression Operator Value

    =CDate(Fields!MyDate.Value).ToShortDateString > CDate (DateAdd(DateInterval.year, -3,now).ToShortDateString)

    Example:

    MyDate

    20060101 ----Do not want this

    20070403 ----Want to see this

    20080420 ----Want to see this

    20040420 ----Do not want this

    Changinagain

  • I would think you would want to filter that in your SQL Statement so you are not bring all the data across the wire and then filtering it. I mean this is what SQL Server is best at.

  • That is what I would normally do but for this report I am using a Data Viewer Web Part and Web Site Data Sources so I am not actually writing a query for the data. Not by my design but that is what I have to work with.

    Changinagain

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply