Link to home
Start Free TrialLog in
Avatar of aneilg
aneilgFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ssrs date expression

i have the following expression.

=IIf(DateDiff("d", Fields!Max_Date.Value, Now()) = 0, "Green",
Iif(DateDiff("d", Fields!Max_Date.Value, Now()) > 7,  "Orange",
Iif(DateDiff("d", Fields!Max_Date.Value, Now()) > 30, "Red", "Black") ) )

but its only evaluating the day and not the month.
my date is 22-05-2012.

thanks
Avatar of SThaya
SThaya
Flag of India image

your expression evaluate only the no of days difference between now() and Fields!Max_Date.Value . because you have mentioined the interval as "d"



Tell me what is your exact requirement?
Avatar of aneilg

ASKER

its the same requirement, but evaluate the day and month.
as an example.
22-05-2012 wiil be the same as 22-04-2012, which is incorrect.
ASKER CERTIFIED SOLUTION
Avatar of ValentinoV
ValentinoV
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Now I noticed, the error is in your expression: >30 is also >7 and you've put the >7 condition first.

Try this instead:

=Switch(
  DateDiff("d", Fields!Max_Date.Value, Now()) > 30, "Red",
  DateDiff("d", Fields!Max_Date.Value, Now()) > 7,  "Orange",
  DateDiff("d", Fields!Max_Date.Value, Now()) = 0, "Green",
  true, "Black")
Avatar of aneilg

ASKER

thanks