Forum Discussion

BulldogTom's avatar
BulldogTom
New Member
2 years ago
Solved

Conditional Formatting to Conditional Column if Null Field

Hello! I would like to apply conditional formatting to a conditional column I created in Power BI Desktop but I'm stumped. I have a table with four columns.  The RTA_Current column is conditional and fills in if there is a date in RTA_Actual. The logic I'd like to apply is:

 

If RTA_Actual is not null 

Change RTA_Current background color to gray

 

If RTA_Actual is null

Change RTA_Current background color to yellow if < 30 days from today

Change RTA_Current background color to red if < Today

 

Any ideas?

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  BulldogTom ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    var _datediff=DATEDIFF(MAX('Table'[RTA Current]),TODAY(),DAY)
    return
    IF(
        MAX('Table'[RTA Actual])<>BLANK(),"gray",
        IF(
            MAX('Table'[RTA Actual])=BLANK()&&_datediff<30,"yellow",
            IF(
             MAX('Table'[RTA Actual])=BLANK()&&MAX('Table'[RTA Current])<TODAY(),"red"  
    )))

    2. [[RTA Current] – Conditional formatting – Background color.

    3. Result:

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  BulldogTom ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    var _datediff=DATEDIFF(MAX('Table'[RTA Current]),TODAY(),DAY)
    return
    IF(
        MAX('Table'[RTA Actual])<>BLANK(),"gray",
        IF(
            MAX('Table'[RTA Actual])=BLANK()&&_datediff<30,"yellow",
            IF(
             MAX('Table'[RTA Actual])=BLANK()&&MAX('Table'[RTA Current])<TODAY(),"red"  
    )))

    2. [[RTA Current] – Conditional formatting – Background color.

    3. Result:

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • BulldogTom's avatar
      BulldogTom
      New Member

      Thanks for taking a look.  I'll read up on these options.  Here is a data excerpt:

       

      ProjectRTARTA Actual
      B591 breakroom HVAC repairs12/01/202201/18/2023
      DDRT Add B811 to the DDRT FIS Contract01/22/2024 
      DDRT B499A and B499B Fire Pump Repairs10/27/202205/15/2023
      DDRT B581 Restroom Partition Renovation12/14/202212/14/2022
      DDRT Renovation Building 552 Zone One Restrooms03/31/202203/30/2022
      DDRT Replace Carpet in B50001/16/2024 
      DDWG Bldg. 368 Overhang Bay E South West06/30/2023 
      DDRT B499 East Dock Canopy Replacement1/22/2024 
      DDWG Bldg. 660 Damaged Fire Riser Repair10/19/202210/19/2022
      DDRT Inst Big Fans in B499 Z202/12/2024 
      DDNV Replace Dry Fire System Compressors03/15/2024