I want to work out an annual figure as a proportion of the year based on the date - so if 400 is the annual figure, I want to divide this by 365 then multiply the result by however many days is equivalent to today's date (e.g. (400/365)*160)).
Is there a way of doing this with a SQL server select statement to avoid manually entering the 160 figure?
The 400 figure is coming from a standard field named HES.
Thanks.
You can use
datepart(dayofyear, getdate())
- will return a number representing today's day of the year. See MSDN DatePart