Reputation: 29
I have a SSRS indicator that I am trying to get to turn green if the the update date is today or yesterday. The Below Code is the expression used which works for today. my question is how could I get this to also show if it was updated yesterday.
=IIF(Fields!UpdateDte.Value<Today, "100","1")
The query that populates the date is a simple query populating a data time. This is in SQl Server Reporting services SSRS 2008 R2. I then used a numeric to have 100 be red and 1 be green.
Upvotes: 0
Views: 384
Reputation: 11105
Always use DateDiff to compare two datetimes; it is also available in SSRS; i.e.:
=IIf(DateDiff("d", CDate(Fields!UpdateDte.Value).ToShortDateString, CDate(Today).ToShortDateString) <= 0, "Green", "Red")
Upvotes: 0
Reputation: 14108
Try this:
=iif(DATEDIFF("d", Fields!UpdateDte.Value, Today)>1,"Red","Green")
Upvotes: 1