Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi, I need help in defining the background color of matrix in combination of matrix row and column headers, for example i have buckets in both row and column headers of matrix for current(column) and previous(row) months.
I have created the two columns one defines the values of Previous month
Previous color formula
Other one has the current month values
Now i have created the other column as Color:
Hey, what's up?
I'm having a problem similar to the one you raised and I wanted to know if you'd found a way to solve it.
Thank you very much.
Best regards
Miracles.
Hi Sorry for the late response, no have used the image instead.
We can do it but it takes a couple of steps. The problem is, in your example the intersection of
Current Month: "Above 500"
Previous Month: "Zero"
does not exist. It's not = 0, it is NULL which means PowerBI does not see it at all in order to apply the color.
We can create fake results by using a measure like so
Zero Value =
VAR _tbl =
CROSSJOIN (
VALUES ( Data[Current Month] ),
VALUES ( Data[Previous Month] )
)
RETURN
COUNTROWS ( _tbl ) * 0
This will return a 0 on every combination of [Current Month] and [Previois Month]
Then we add that into your measure simply by putting '+ [Zero Value] on the end of your measure.
Now we get a table with results in every field and finally we can use a formatting measure to format the background.
Formatting measure:
Color =
VAR _CM = SELECTEDVALUE ( Data[Current Month] )
VAR _PM = SELECTEDVALUE ( Data[Previous Month] )
RETURN
SWITCH (
TRUE (),
_CM = "Zero" || _CM = "Below 100", "Red",
_CM = "100 to 400" || _CM = "Above 500", SWITCH (
TRUE (),
_PM = "Zero" || _PM = "Below 100", "Yellow",
_PM = "100 to 400" || _PM = "Above 500", "Green"
)
)
I have attached my sample file for you to look at.
Thanks for your response, Hope this should work, I will check this.
Hi @Amit_Saxena .
First create a table with the column header of the matrix, see as below:
Then create a measure as below:
Measure = IF(MAX('Table'[Bucket Previous month])="zero"&&MAX('Table 2'[Bucket Previous month])="zero",1,
IF(MAX('Table'[Bucket Previous month])="Below 100"&&MAX('Table 2'[Bucket Previous month])="Below 100",2,
IF(MAX('Table'[Bucket Previous month])="100 to 400"&&MAX('Table 2'[Bucket Previous month])="100 to 400",3,
IF(MAX('Table'[Bucket Previous month])="above 500"&&MAX('Table 2'[Bucket Previous month])="above 500",4,BLANK()))))
This is a way to avoid invalid values in the matrix.
Then add a conditional format for the measure.
Finally you will see:
In the matirx visual ,you need to use the column of table 1 as rows, and the column of table 2 as columns.
For the related .pbix file,pls click here.
Thanks for your response! if you see my screen shot and the kind of view i need, I want to show the specific and different color in blank cells for example last two rows should have red background color . I need three differerent colrs in differnt location, pls review the screen shot as required view
Hi @Amit_Saxena ,
Sorry but for the same value,currently we can only define one color .
You can come up with a new idea and add your comments there to make this feature coming sooner. https://ideas.powerbi.com/forums/265200-power-bi-ideas
Would it be acceptable to show 0 instead of blank? Then the background color should activate.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.