aneilg
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
=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
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.
as an example.
22-05-2012 wiil be the same as 22-04-2012, which is incorrect.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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")
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")
ASKER
thanks
Tell me what is your exact requirement?