Avatar of aneilg
aneilg
Flag 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
SSRS

Avatar of undefined
Last Comment
aneilg

8/22/2022 - Mon
SThaya

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?
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
ValentinoV

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ValentinoV

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")
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
aneilg

ASKER
thanks