latest Post

Date Filtering SSRS report issue

Today, one of our users reported an issue with one of our SSRS reports. The report in question allows the user to filter a report between two dates using dynamic filtering allowing them to choose which date field to filter on.

The user was reporting that some data was missing the upper boundary i.e. running for 30/03/2018 to 31/03/2018 was missing data from the 31st.



After checking the  query in the SSRS data set to ensure the correct "greater than" and "less than" logic I noticed it was using the SSRS between operator however, everything appeared to be setup fine.

This told me the offending item must be the time portion of the time stamp. The fields we are filtering on in CRM are all setup as date only fields which  means CRM stores the date as "00:00:00" therefore should not cause a problem in this case.

However, we recently imported data from a legacy system and some of the records were imported with a timestamp other than midnight.

I now understood the problem.

The SSRS between function is looking for records between 30/03/2018 00:00:00 and 31/03/2018 00:00:00 and is not including anything from the 31/03/2018 which was edited after midnight.


To fix I created a calculated field for each date filter which converted the date to a formatted string which essentially removes the time from it. I then used the CDATE function to convert it back to a datetime field which will set the time to 00:00:00. I then used these fields in my filter expression and everything works as normal .

It feels like there probably is a better way to deal with this  and I am happy to hear from anyone else in the community on better ways but the above solution worked for me and allowed the user to quickly begin using the report again.



Recommended Posts × +

1 comments:

  1. I really want to thank Dr Emu for saving my marriage. My wife really treated me badly and left home for almost 3 month this got me sick and confused. Then I told my friend about how my wife has changed towards me. Then she told me to contact Dr Emu that he will help me bring back my wife and change her back to a good woman. I never believed in all this but I gave it a try. Dr Emu casted a spell of return of love on her, and my wife came back home for forgiveness and today we are happy again. If you are going through any relationship stress or you want back your Ex or Divorce husband you can contact his whatsapp +2347012841542 or email emutemple@gmail.com website: Https://emutemple.wordpress.com/ Https://web.facebook.com/Emu-Temple-104891335203341

    ReplyDelete