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 |
jneff02
Starting Member
10 Posts |
Posted - 2009-08-06 : 11:07:39
|
I think this is a reporting services question. I have a report that prompts for date range params:equipdet.gldate BETWEEN @fromdate AND @thrudateIs there a way in the layout to have an expression that takes the date range and totals the number of whole months? Example; 1/1/09 through 3/31/09 would equal 3 months. I then would like to multiply the number of months by on of the Field Values. I think the hard part here for me is to know if I can do the date range part. Thanks in advance. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-08-06 : 11:32:25
|
Not sure how to apply this to the reporting services interface but a t-sql expression to get your answer is:datediff(month, @fromdate, @thrudate) + 1Be One with the OptimizerTG |
|
|
jneff02
Starting Member
10 Posts |
Posted - 2009-08-06 : 11:56:43
|
Dude, you rock. I had to change it a little to fit SSRS but that was the spark I needed. The expression I used was...datediff("m", Parameters!fromdate.Value, Parameters!thrudate.Value) + 1I already had the fromdate and thrudate set as params so I just pulled from those. I then wanted to mulitply by another Field Value so my end result for this cell was...=SUM((datediff("m", Parameters!fromdate.Value, Parameters!thrudate.Value) + 1) * Fields!Month.Value)It works like a charm now. TG thank you for your input and quick response. I have to say I really like these forums. |
|
|
|
|
|