'How to conditionally format text in PowerBi

Is there a way to conditionally format my table so I can add a bar like below? (it was created in excel)

Image I want to create: Image I want to create

I am currently stuck with the following - I highlighted the dates but need to know how I can highlight the holidays in my table with that grey color. (the picture below uses Thanksgiving as the example). My goal is to highlight each individual holiday in the table in grey.

Image I need to conditionally format Image I need to conditionally format

Here is what I tried with the formula provided below: Attempt



Solution 1:[1]

  1. You need a date dimension that has an attribute like isHoliday.

  2. Create a measure where you specify the color in the Hex Code format ("#A1A1A1") for instance:

     measure_color_coding_holiday = SWITCH ( TRUE (), 'Date'[IsHoliday] = "yes", "#808080", 'Date'[IsHoliday] = "No", "#FFFFFF" )
    
  3. Go to the conditional formatting for the column > Background Color. Choose Field value and pick the new measure.

/Tom

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman