Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

conditional formating for weekends in the matrix visual

I need highlight saturday  and sunday with colors for the below matrix

 

4 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    If you are not using date dimension in your model and you haven't got a weekday column already, you can use this measure for conditional formating In your Matrix visual

    isWeekend = INT( WEEKDAY( SELECTEDVALUE( 'Table'[Date] ), 2 ) IN { 6, 7 } )
     
    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      no i have date dimension seperately

  • Anonymous , Create a measure like this checking the weekday value

    if(FIRSTNONBLANK(Table[Value],"true") = "true","green","red")

    or

    if(FIRSTNONBLANK(Table[Weekday],"AnyDay") in {"sun","sat"},"green","red")

     

    And the in conditional formatting use field option with this measure

    Steps :

    https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
    https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous,

    You can use below measure formula to add a measure and setting condition formation on your value field based on measure result:

    Measure =
    VAR currDay =
        MAX ( 'Table'[Day] )
    VAR currDate =
        DATEVALUE ( currDay & "-" & MAX ( 'Table'[Month] ) )
    RETURN
        IF ( WEEKDAY ( currDate, 2 ) > 5, "Blue", "Black" )
    

    Since I'm not so sure your table structure, can you please share some dummy data with a similar datas tucute and visual design to help us clarify your scenario?

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng