expression in textbox

Who is online?  0 guests and 0 members
Home  »  Forums   »  microsoft business intelligence   »  reporting services   » expression in textbox

expression in textbox

Topic RSS Feed

Posts under the topic: expression in textbox

Posted: 5/17/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

hi

i need to have expression in textbox like 

 

= "value on " + dateadd("dd" , - 1 , dateadd("yy",datediff("yy",0,filed1.value),0))

 

but when i run report it shows like #error

 

-----------------

 

another question is how to add filed value as sum

example.

 

item1                               1000

item2                               2000

 

total                           3000

 

i need to have sum of this field in total.

 

how to add this values in ssrs

dateadd(DD, -1, dateadd(YY,datediff(yy,0,@date),0))

Posted: 5/17/2012

Padawan 362  points  Padawan
  • Joined on: 7/27/2010
  • Posts: 106

1. datediff("yy",0,filed1.value) is not correct

instead of "yy" has be "yyyy", instead of 0 has be date value


Posted: 5/17/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

thanks alot ,its working now


Posted: 5/17/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

can you write ,how this should be exactly.

 

i dont what should i put in place of dd,still getting error

 

dateadd(DD, -1, dateadd(YY,datediff(yy,0,@date),0))

Posted: 5/17/2012

Padawan 362  points  Padawan
  • Joined on: 7/27/2010
  • Posts: 106

Instead of DD or YY use DateInterval.Day and  "yyyy"

and 0 is not a valid date format, so use you @date parameter or Fields!filed1.Value(date value)

 

=dateadd(DateInterval.Day, -1, dateadd("yyyy",datediff("yyyy",Fields!filed1.value,@date),@date))


Posted: 5/17/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

i cannot use anything else in plac eof 0,

 

the value will be different 

 

= "Portfolio value on " +  dateadd(DateInterval.Day, -1, dateadd(DateInterval.Year,datediff(DateInterval.Year,0,Fields!ThruDate.Value),0))

 

this is my complete expression , how can i place anything else in place of 0


Posted: 5/17/2012

Padawan 362  points  Padawan
  • Joined on: 7/27/2010
  • Posts: 106

Syntax


DATEDIFF(interval, datetime, datetime)

you can't use 0 for datetime parameter

interval

Specifies the units (year, quarter, month, day, hour, minute, second or week) used to calculate the date difference.

datetime

Specifies the start date.

datetime

Specifies the end date.

http://msdn.microsoft.com/en-us/library/aa337092%28v=sql.90%29.aspx


Posted: 5/18/2012

Jedi Master 2811  points  Jedi Master
  • Joined on: 2/19/2010
  • Posts: 406

I am not sure the 0 is your problem.  In T-SQL a 0 converts to 1900-01-01 00.00.00.000.  So if it is the zero that is really causing the problem you should be able to substitute 1900-01-01 00.00.00.000 but since you only need the date you should be able to just use 1900-01-01.

Rather than saying it doesn't work, why don't you try to tell us what you are trying to do with the expression?


Posted: 5/18/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

ok.what i am trying to do is ,

i hv 1 textbox, which should show value like "value on (date)

 

this date should be last day of previous year

 

 

and this is calculting based on param @todate

 

 

so if @todate = 03/31/2010

 

the report should show value on 12/31/2009

 

 

this exp works on sql,dont know y its not working in ssrs

 

 


Posted: 5/18/2012

Jedi Master 2811  points  Jedi Master
  • Joined on: 2/19/2010
  • Posts: 406
Answered  Answered

SSRS doesn't like the zero,  so you need to substitute a hard date for it.  This should work for you

=DATEADD("d",-1,DATEADD("yyyy",DATEDIFF("yyyy","1/1/1900",@Date),"1/1/1900"))


Posted: 5/18/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

thanks daniel.

it works


Posted: 5/18/2012

Jedi Master 2811  points  Jedi Master
  • Joined on: 2/19/2010
  • Posts: 406

Please mark the question as answered


Page 1 of 1 (12 items)