Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bh0526
Yak Posting Veteran
71 Posts |
Posted - 2011-09-06 : 14:30:17
|
I simply want to subtract 1 from today's year and display only the year like "2010". I have tried a million different DATEADD methods and nothing I do works. Can anyone help?Thanks,Bob |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-09-06 : 14:34:05
|
SELECT DATEPART(year, GETDATE())-1That works in T-SQL, not sure about Analysis Services but should be similar. |
|
|
bh0526
Yak Posting Veteran
71 Posts |
Posted - 2011-09-06 : 14:50:24
|
I am using SSRS not T-SQL. Your solution does not work. I get this error:'Year' is invalid. ArgumentsWrong |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-09-06 : 14:58:49
|
Then use this in an expression:=Year(Now())-1 |
|
|
bh0526
Yak Posting Veteran
71 Posts |
Posted - 2011-09-06 : 15:28:23
|
That worked Rob. Thanks! |
|
|
|
|
|