Search code examples
datereporting-servicesformattingconditional-statements

Conditional Formatting in SSRS


I am a bit new with SSRS, I need to do a conditional formatting in SSRS, where if the last_backup_date is less than 3 days, the column will be "Yellow" and if it is less than 7 days, then the column will be "Red"... I can't figure out how to do this. Any help would be appreciated. I tried using Switch function but just can't figure out which Date & Time function to use here. Thanks in advance


Solution

  • Try using this:

    =Switch(
    DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<3,"Yellow",
    DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<7,"Red"
    )
    

    Update

    Adding an additional condition based on comments.

    =Switch(
    DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<3,"DarkGreen",
    DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<=7,"Yellow",
    true,"Red"
    )