Forum Discussion

aya80's avatar
aya80
Regular Visitor
3 years ago
Solved

Conditional formatting red, yellow and green

Hello, I need some, help please with conditional formatting. My example below is the requirement I am working on. I need to create a report to show red amber and green status against the various dat...
  • Wilson_'s avatar
    Wilson_
    3 years ago

    Hi Aya,

     

    No worries!

     

    So if I'm understanding correctly now (and knowing nothing else about your data model), I would do something like the following.

     

    • Create three measures, one for each course, since they have different timelines. (Example for Business Continuity below. You will need to update the RetakeDate variable when you create the measure for the other two columns.) This measure will tell the conditional formatting in the next step what colour to highlight the cell.

     

    Business Continuity Conditional Formatting = 
    -- Since it must be taken within a year, EDATE takes the date and calculates 12 months in the future
    VAR RetakeDate = EDATE ( MIN ( Table1[Business Continuity] ), 12 )
    VAR Colour =
    SWITCH (
        TRUE(),
        TODAY() - RetakeDate >= 365, "Red",
        TODAY() - RetakeDate >= 335, "Yellow",
        "Green"
    )
    
    RETURN Colour

     

    • Right click the field in your table/matrix, going to Conditional Formatting, then Background Colour.
    • Change Format Style to Field Value, then picking the corresponding field under "What field should we base this on?"

     

    Here is a sample file I created in case it helps. This is what my report page looks like.

     

     

    Please let me know if this is not what you were looking for or if your data model doesn't quite match and you're unable to modify the measure to your needs. 😄


    ----------------------------------
    If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

  • aya80's avatar
    aya80
    3 years ago

    Hi Wilson,

     

    Thank you so much! The measures work. Thanks again