Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Query Question

$
0
0
Hello All, Please see the image of what I am trying to accomplish [img]https://i.imgsafe.org/b511c9d15f.jpg[/img]I tried to add the following code to get the value for FordwardSchdDate ( CASE WHEN wt.TravLineNum = 1 THEN dbo.harbor_fn_DateAdjustWorkingDaysOnly(0 - wt.ProjectedCycleTime, wt.CapacitySlotDateTimeValue) ELSE dateadd(minute, SUM(wt.ProjectedCycleTime) OVER(Partition by wt.ProjectedCycleTime), wt.CapacitySlotDateTimeValue) END ) AS ForwardSchdDateThis logic works fine for the first value when TravLineNum is 1. However, the cumulative dates are not calculating up correctly. Does anyone have any suggestions on how I can fix this?

Viewing all articles
Browse latest Browse all 3145

Trending Articles