0

I am attempting to create a report to change Values to Red, Yellow and Green based upon the last inspection date. Inspections are every three years if DUE is in the last inspection then I want the cell to turn red, if the last inspection has been in the last 2 years I need it green and in the year that it needs and inspection I need it yellow. Here is what I have NOT working :)

=SWITCH(Fields!Inspection_x0020_Expires0.Value = "DUE","Red"),
(Fields!Last_Inspection.Value = "d" < 730,"Yellow")
(Fields!Last_Inspection.Value = "d" > 730,"Green")

Thank you for taking the time to help me.

Tim

trevorp
  • 1,161
  • 1
  • 14
  • 19
RCapps
  • 1
  • 2
  • 1
    You should edit your question. It looks like you've got your brackets wrong but that might be a posting mistake (you still have "enter code" in your posted expression) – tomdemaine Jul 27 '17 at 14:14
  • Thank you, it was my first post on this site and that was created by stack overflow, will pay better attention. – RCapps Jul 27 '17 at 14:30
  • I tried this, =DateDiff(DateInterval.Day, Fields!Last_Inspection.Value, Today > 730 "d" = RED). It had no effect – RCapps Jul 27 '17 at 18:21

2 Answers2

0

Use the DATEDIFF function to compare the last inspection date to today.

DateDiff(DateInterval.Day, Fields!Last_Inspection.Value, Today) < 730
bushell
  • 560
  • 3
  • 10
0

Here is what I ended up doing, I added a column Named Textbox6 and calculated the number of days with a DateDiff =DateDiff("d", Fields!Inspection_x0020_Expires0.Value, Today()) to get the number of days and then I used that value to create my background text box color =Switch (Not(isNothing(Fields!Last_Inspection.Value)) and ReportItems!Textbox6.Value <= 729, "Green", ReportItems!Textbox6.Value >= 730 and ReportItems!Textbox6.Value <=1094 , "Yellow", isNothing(Fields!Last_Inspection.Value) or ReportItems!Textbox6.Value>1094, "Red" )

RCapps
  • 1
  • 2