473,440 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

How do I omit weekends from a day count?

2
I have created a report using Report Builder for SQL Reporting Services which is used with our Service Desk software. The report shows all incidents that have been open for 3 days or more and the number of days the incidents have been open. I need to be able to omit weekends from the filter and the number of days the incidents have been open, so the report can show the number of work days an incident has been open. Is this possible and if so, how? Thanks in advance.
Mar 19 '10 #1
4 3324
RedSon
5,000 Expert 4TB
Couldn't you just subtract a multiple of two days for every item that is more than a multiple of 7 days old?
Mar 19 '10 #2
ira4th
2
@RedSon
Yes & no. The report is for incidents 3 days or older and its run on Tuesdays (I know, weird for a weekly report) so there's the weekend to deal with there. Also, I do not have much experience with SQL, so I would have to do it manually and I am trying to avoid that. I came to this site because I was searching for help with SQL queries/coding.
Mar 19 '10 #3
ck9663
2,878 Expert 2GB
Check the dataname of the weekday to exclude whatever day you want to exclude.

Happy Coding!!!

~~ CK
Mar 19 '10 #4
Delerna
1,134 Expert 1GB
I do not have much experience with SQL
I come here to lend a helping hand to those who want to improve their experience.

I came to this site because I was searching for help with SQL queries/coding
So if you really are looking for guidance to help you solve the problem and not a ready made solution done for you......then

There is no "magic" way to do this. At least ... there isn't in SQL Server 2000 that I am aware of.
You will have to perform math in your query to calculate it

getdate returns the current date
weekday returns the day of the week for a date. 0=Sun,1=Mon .... etc

using those to functions as well as the NumDaysIncidentOpen in your query you can use math to get a precise NumWorkDaysIncidentOpen in the query.

It can get a bit hairy if you have partial weekends but since you call it "Number Of Workdays" I assume you won't have any.

Something like this
Find out how many workdays for the current week to today
Subtract that from NumDaysIncidentOpen
If remainder is positive then divide the remainder of days by 7 to get the number of weekends
Subtract NumWeekends * 2 from NumDaysIncidentOpen to get the Number of workdays.
Mar 21 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: MLH | last post by:
With a table of holidays and A97's date fn's - how best to count weekends and holidays between two dates? My holiday table has 4 fields. I will be adding records to it each year as info becomes...
0
by: psuaudi | last post by:
I have a database that involves moving product from one status to the next. When the status is changed, it saves the date of the change, and from where the product was moved. Ex. of one product...
3
by: eskelies | last post by:
I have a rolling cumulative income amount for each day. Right now my query would need me to run it everyday (weekday, weekend or holiday) for it to work. My data looks something like this: ...
0
by: Trent Nelson | last post by:
Following on from the success of previous sprint/bugfix weekends and sprinting efforts at PyCon 2008, I'd like to propose the next two Global Python Sprint Weekends take place on the following...
0
by: Michael Foord | last post by:
Trent Nelson wrote: I should be able to help organise and attend the London contribution. Personally I'd like to work on the documentation changes / clean-up for the unittest module discussed...
0
by: =?ISO-8859-1?Q?Tarek_Ziad=E9?= | last post by:
On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord <fuzzyman@voidspace.org.ukwrote: We are trying to set up a team here in Paris, Personnally I would like to continue the work started in distutils...
4
ddtpmyra
by: ddtpmyra | last post by:
I have below query inside the ms access, but this query counts all the days including the weekend but I only wanted to count the NUMBER of weekday (Monday to Friday). Please help Number of Days...
1
by: trixxnixon | last post by:
This code omits weekends, holidays and returns a due date as well as the number of business days due. it also adds an extra day to the reqest if it was submitted after 5:00. as you can see that...
8
by: anirudhbapu | last post by:
Hello people, I have a daily script which i execute it manually on daily basis.. 1.On week days i need to run this script on 8 in the morning 2.ON week ends i need to run this at 8 in the night...
9
by: Scholar81 | last post by:
Hello, I am a novice Access developer and my boss asked me to build a database and I said yes. Now I realized the bite is way too big and I'm trying not to choke ;-) And what's worse, he does...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.