Forum Discussion
Power BI matrix header custom formatting
I want to apply color coding to a field in the Columns area of a Power BI matrix. Is there a way to create a DAX measure that switches colors based on the value of that Columns field, or some other approach I can take? The UI doesn't allow conditional formatting other than for the Values field. Any alternatives?
5 Replies
- Shai_Karmani
Super User
Column header conditional formatting is actually supported in the matrix, it is just hidden in a different part of the Format pane than the Values conditional formatting.
Create a measure that returns a color code using SELECTEDVALUE on your Columns field, for example:
Header Color = SWITCH ( SELECTEDVALUE ( 'YourTable'[YourColumnField] ), "North", "#1F77B4", "South", "#FF7F0E", "East", "#2CA02C", "West", "#D62728", "#333333" )
Then open the Format pane and go to Visual > Column headers > Values. Click the fx button next to Font color (or Background color), choose Format style = Field value, and point it at the measure. SELECTEDVALUE picks up the current column header value, so each header gets its own color. If you have multiple fields in Columns and need to format a specific level only, wrap the SWITCH in an ISINSCOPE check for that field.
If this helped, a thumbs up and accepting the solution would be appreciated.
Best regards,
Shai Karmani
- dcohenvogelRegular Visitor
Is this option specific to a particular version. I'm working in Desktop, Version: 2.158.1177.0 64-bit (September 2026) --- I go to Visual > Column Headers > ... there's no Values sub-menu there. The only place I see the fx option with Values is under the Cell Elements. Am I misunderstanding?
- grazitti_sapna
Super User
Hi dcohenvogel,
Unfortunatly there is no way to apply condition formatting in Matrix visual, Currently, conditional formatting can be applied only to the values in a Power BI Matrix, not directly to row or column headers. However, if the columns are created as individual measures rather than values from a field placed in the Columns area, you can assign a specific color to each column header. This approach, however, does not support dynamic or conditional formatting based on the header value.
As an alternate, You can overlay Shapes or Card visuals on top of the table or matrix headers to create a customized header design. These visuals can be dynamically formatted using measures, allowing you to apply conditional colors based on the underlying data or business logic.
Another Option is you can go with custom visuals like Deneb.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUserand Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!Refer this thread
- Poojara_D12
Super User
Hi dcohenvogel
Yes, this is possible in a Power BI Matrix. You don't need to apply conditional formatting to the Values field itself. Matrix column header conditional formatting is available separately in the Format pane. You can create a measure that returns the required hex color based on the current column value, for example using SELECTEDVALUE() on the field placed in the Columns bucket, and then use that measure under the column header's conditional formatting Font color or Background color Format style: Field value. This is the cleaner approach because the color logic stays in DAX and will dynamically respond to the column being displayed.
- dcohenvogelRegular Visitor
Poojara_D12 Thanks for the reply. However, I don't see any conditional formatting option for the column header or row header in Power BI. Here's what I see...