SSRS Counting Rows based on Date

  • Hello Everyone,
         I have a dataset that's bringing back 3 months of data, including a date.  What I would like to do is count the number of records based on todays date.  I have an expression built but it's not working...

    =SUM(Iif(Fields!CompletedDate.Value = Today(), 1, 0))

    Am I on the right track or is this just not possible in ssrs and will have to find another way?

    Thanks for your help in advance
    Matt

  • if your completedDate column is datetime, that could be your issue, comparing something with a time element to something without one.

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

  • Yes, it is.  I will have to find another way.  Thanks for the reply!

  • either change the format in the query, or use something like FormatDateTime(Fields!CompletedDate.Value,DateFormat.ShortDate) = Today()

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

  • I tried to format it and for some reason it still didn't work.  I did find a workaround though(not the most efficient way though).

    thanks for the input!

  • meichmann - Friday, April 20, 2018 3:46 AM

    I tried to format it and for some reason it still didn't work.  I did find a workaround though(not the most efficient way though).

    thanks for the input!

    Probably better to add an additional column in your stored procedure, that is simply CONVERT(date, your_date_column_name_here) AS NewDateColumn

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 6 posts - 1 through 5 (of 5 total)

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