Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
benmcmahon
Helper II
Helper II

Conditional formatting for values in a Matrix visual based on the date

Hello,

 

I am currently trying to create a matrix visual where each column is a month and have the conditional formatting shade certain values in based on the month they are in. Eg. for this visual I have posted a screenshot of, I would like all coumns, or the column headers, to all be shaded for the months after october.

 

All help is appreciated,

Thanks.

 

38491a2a-291c-493f-bb96-5a43d25bb38e.png

4 REPLIES 4
benmcmahon
Helper II
Helper II

That solution is viable, however the solution I found worked best was ranking the months and adding the condition that way as so:

 

Eg.

Conditionalformatting =
Var selectedmonth = SELECTEDVALUE('DateTable'[Date (bins)])
Var ranktable = ALLSELECTED('DateTable'[Date (bins)])
Var Productrank =
RANKX(ranktable, 'DateTable'[Date (bins)], selectedmonth)
Var CF = if(Productrank < 7, "Light blue")
Return CF
 
Thank you for youre response 
v-henryk-mstf
Community Support
Community Support

Hi @benmcmahon ,

 

The conditional format is applied to the values that satisfy the condition, and the corresponding column names do not apply.

M = IF(MONTH(MAX('Table'[Date]))>MONTH(TODAY()),"grey","white")

vhenrykmstf_0-1659686088884.png

 

For more details, you can read below blog:

Power BI Conditional Formatting: The Ultimate How-To Guide (hevodata.com)


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

benmcmahon
Helper II
Helper II

Thank you for your reply, when trying to use this formula, it cannot use my date table or the columns in it. Do you know why this would happen?

 

amitchandak
Super User
Super User

@benmcmahon , As of now, you can not do conditional formatting on row/column of Matrix

 

For values, you can have. Create a color measure and use that in conditional formatting using field value option

 

Colour =
SWITCH(TRUE(),
'Table'[Date] < TODAY(), "red",
'Table'[Date] = TODAY(), "orange",
"green")

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.