Counting the difference between dates SQL Report builder
Hi Guys, I am trying to create a report that will count all of the days that members of staff that are absent. I have a variable named From and a variable named To. These hold the dates that members of staff are off. An example would be: Name: From: To: Annie 04/10/2012 05/10/2012 John 05/09/2012 25/09/2012 I want to get a total of all the absent staff but it has to exclude weekends. So far I have this: =datediff("ww",Fields!From.Value,Fields!To.Value, vbMonday) +datediff("ww"Fields!From.Value,Fields!To.Value, vbTuesday) +datediff("ww",Fields!From.Value,Fields!To.Value, vbWednesday) +datediff("ww",Fields!From.Value,Fields!To.Value, vbThursday) +datediff("ww",Fields!From.Value,Fields!To.Value, vbFriday) But this doesnt work and it would not be date inclusive. ANy suggestions? Imran Ashrab
October 5th, 2012 4:51am

Hi Imran, Based on your description, you want to count the workday between two dates. In order to achieve your requirement, we can use custom code in report. The following thread is about the same issue, you can take as reference. http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/3a496e08-ca50-4421-9484-36a049d457c7/ For more information about custom code in SSRS, please see: http://msdn.microsoft.com/en-us/library/ms156028.aspx Regards, Fanny LiuFanny Liu TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
October 8th, 2012 5:30am

Hi Imran, If you want to implement it in your sql, You can take a look into this Exclude Weekend days link.Aftab Ansari
October 8th, 2012 5:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics