Forum Discussion

Lora_0121's avatar
Lora_0121
Icon for Advocate I rankAdvocate I
1 month ago
Solved

How to Apply Dynamic Text Colors to Date Headers Based on Weekdays in Power BI?

Hello.

 

Is there a way to apply different text colors based on the day of the week, as shown in the image below?
I'd like Saturdays to be blue, Sundays to be red, and weekdays to be black.
The text color should be applied dynamically so that it automatically follows the correct day of the week as the calendar changes each month.

For example, July 1 falls on a Wednesday, so it should be displayed in black. However, August 1 falls on a Saturday, so it should be displayed in blue. The text colors should update automatically based on the day of the week for each month.

 

6 Replies

  • Hi Lora_0121 - Create a DAX measure that determines the day of the week and returns the appropriate color code.

     

     

     

    Hope thishelps.

     

     

     

  • v-csrikanth's avatar
    v-csrikanth
    Icon for Community Support rankCommunity Support

    Hi Lora_0121 
    We would like to inquire whether have you got the chance to check the solutions provided by danextian ryan_mayu rajendraongole1 in community to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.

  • v-csrikanth's avatar
    v-csrikanth
    Icon for Community Support rankCommunity Support

    Hi Lora_0121 

    We wanted to follow up and check whether you had a chance to review our previous response and if the issue has been resolved.

    If you are still experiencing the issue or have any additional questions, please feel free to share an update. We’ll be happy to assist further.

     

    Thank you,
    C Srikanth
    Community Support Team

  • ShahRukhSameer's avatar
    ShahRukhSameer
    Icon for Continued Contributor rankContinued Contributor

    Hi Lora_0121

     

    Unfortunately, the native Matrix visual doesn't support dynamic formatting of column header text, so you can't automatically make Saturdays blue, Sundays red, and weekdays black as the dates shift each month.

     

    One workaround is to create a separate header row using another visual and apply conditional formatting there based on the day of the week. Another option is to use a custom visual such as Deneb, which gives you much more control over dynamic formatting, including header colors.

     

    If you're specifically using a Matrix, you could also make weekends stand out by creating custom labels. For example:

    Date Header =
    VAR DayNo = WEEKDAY('Calendar'[Date], 2)
    RETURN
    SWITCH(
    TRUE(),
    DayNo = 6, "🔵 " & FORMAT('Calendar'[Date], "dd ddd"),
    DayNo = 7, "🔴 " & FORMAT('Calendar'[Date], "dd ddd"),
    FORMAT('Calendar'[Date], "dd ddd")
    )

     

    This would display something like:

    🔵 01 Sat
    🔴 02 Sun
    03 Mon
    04 Tue

    It's not quite the same as changing the font color, but it does make weekends stand out and updates automatically as the calendar changes.

     

    As far as I know, there isn't a native Power BI setting that supports dynamic weekday-based coloring of Matrix column headers today.