sql - SSRS. Workday Function -
i'm trying convert below excel formula ssrs having looked around cannot seem find solution. can calculate number of working days between 2 dates i'm trying add on number of working days date. don't have 2nd date. guess along lines of dateadd function?
=workday($a1,b$1)
hope can many thanks
here tsql solution add x business days date.
declare @calendar table (thedate date, dayofweek varchar (10)); declare @startdate date = '20170704'; declare @businessdaystoadd integer = 10; insert @calendar select thedate , datename(dw, thedate) dow dbo.datetable('20170701', '20170720') ; temp ( select thedate , dayofweek , rank() on (order thedate) therank @calendar thedate > @startdate , dayofweek not in ('saturday', 'sunday') ) select * temp therank = @businessdaystoadd;
notes
dbo.datetable table valued function happens exist in database using. in real life, might have actual calendar table of sort.
this example not include holidays.
this start of answer posted question. solves problem of essentially don't have 2nd date
.
Comments
Post a Comment