January 27, 2015 at 3:21 pm
Hi,
Pls suggest a robust logic for the following scenario:
Sample Calculation:
12/22/201491 Today -4 0.0353.185Monday
12/23/2014144 Today -30.114.4Tuesday
12/24/2014153 Today -20.3553.55Wednesday
12/25/201413 Today -10.415.33Thursday
12/26/2014260 Today0.0820.8Friday
Total99.76
Over a weekend:
12/17/201410Today -40.0350.35Wednesday
12/18/201423Today -30.12.3Thursday
12/19/201427Today -20.359.45Friday
12/20/201430Today -10.4112.3SaturdaySaturday rolls to Monday
12/22/201491Today -10.4137.31Monday
12/23/2014144Today0.0811.52Tuesday
Total 75.11
All inputs are appreciated.
Thanks
Gayesh
January 27, 2015 at 3:27 pm
If you want some robust logic, how about a robust explanation of how to get from your sample data to your result?
January 27, 2015 at 4:05 pm
I need to get a get a calculation as follows:
if endDate = Today, then (enddateunits * .08) + ( (Today - 1)units * .41) + ((Today - 2)units * .35) + ((Today - 3)units * .1) + (Today - 4)units * .035)) / .975
if a saturday comes in the list, then the value for that day should be the same as monday's.
Thanks.
January 28, 2015 at 7:48 am
What pietlinden is saying is that you didn't provide any details. Please see the first link in my signature for best practices when posting questions.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply