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.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Combining 2 Expression fields as one

Author  Topic 

Adam West
Constraint Violating Yak Guru

261 Posts

Posted - 2010-01-13 : 09:09:06
HI I have to take 2 Expression fields I made and combine them into one. It is simply 2 dates that are column headings, from and to dates. The from date is this:

=DateAdd("m",-4,DateAdd("d",1,Parameters!ENDDATE.Value))

and then the "to" date is this:

=DATEADD("d",-1,DateAdd("m",-3,DateAdd("d",1,Parameters!ENDDATE.Value)))

I am not sure how to combine them to be one Expression field, with some spaces between them of course.

Thank you for any help,
Coops

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-13 : 09:20:25
=Cstr(DateAdd("m",-4,DateAdd("d",1,Parameters!ENDDATE.Value))) & " " & Cstr(DATEADD("d",-1,DateAdd("m",-3,DateAdd("d",1,Parameters!ENDDATE.Value))))
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-01-13 : 09:49:34
Thank you very much Visak
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-13 : 10:24:30
welcome
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-01-13 : 11:51:00
there is one more thing. one of the headings, i just use the parameters
=Parameters!STARTDATE.Value & "-" !ENDDATE.Value

but this is not correct syntax
before it was just =Parameters!Startdate
but now i must combine these 2 as well
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-13 : 11:55:40
use
=Parameters!STARTDATE.Value & "-" & Parameters!ENDDATE.Value

SQL Server MVP
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-01-13 : 13:27:09
thank you Vis i had only one &, now I know.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-13 : 13:29:02
cool

SQL Server MVP
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-01-13 : 16:30:46
Hi I have a question. In my case, I have 4 reports that are variations of this one. It means I have to make the changes now in al..I am not complaining, but how if at all, could this become a more automated change for the future?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-14 : 02:10:20
quote:
Originally posted by AdamWest

Hi I have a question. In my case, I have 4 reports that are variations of this one. It means I have to make the changes now in al..I am not complaining, but how if at all, could this become a more automated change for the future?


yup if they're using 4 separate rdls you need to change them all. alternatively you could make a template for all of them and make them reuse it based on parameters
Go to Top of Page
   

- Advertisement -