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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
msimmonsmcse
Helper I
Helper I

Conditional Formatting a matrix

I have a matrix viz that shows revenue per year, one year for each column, with customers listed in each row. I applied a conditional format (or so I thought) to each cell based on the revenue number. (Cell Elements>Background Color). I was expecting to get a color gradient for each cell, applied row by row, so each client would show their high and low years of revenue filled with the definded background colors for high and low values. But the behavior I am getting is that the format applies the high and low color to the highest/lowest cell in the entire matrix. How do I get the high and low values for each row to show the proper colors?

 

Below is a screen shot with the customer names redacted. 

 

msimmonsmcse_0-1646088971353.png

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @msimmonsmcse 

 

Here is another workaround. When your data table is like below (if not, you can summarize company, year and revenue to get a table like below), 

vjingzhang_0-1646372896818.png

 

You can create a Rank column to rank revenues in different years among every company. 

Rank = 
RANKX (
    FILTER ( 'Table', 'Table'[Company] = EARLIER ( 'Table'[Company] ) ),
    [Revenue],
    ,
    ASC,
    DENSE
)

vjingzhang_1-1646373179995.png

 

Add another color column based on rank values. You can also create a similar measure for conditional formatting. 

Color = SWITCH([Rank],1,"#ABEBC6",2,"#F9E79F",3,"#FAD7A0",4,"#EDBB99")

vjingzhang_2-1646373578449.png

 

Format the background color based on Field value > Color column. 

vjingzhang_3-1646373843942.png

 

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @msimmonsmcse 

 

Here is another workaround. When your data table is like below (if not, you can summarize company, year and revenue to get a table like below), 

vjingzhang_0-1646372896818.png

 

You can create a Rank column to rank revenues in different years among every company. 

Rank = 
RANKX (
    FILTER ( 'Table', 'Table'[Company] = EARLIER ( 'Table'[Company] ) ),
    [Revenue],
    ,
    ASC,
    DENSE
)

vjingzhang_1-1646373179995.png

 

Add another color column based on rank values. You can also create a similar measure for conditional formatting. 

Color = SWITCH([Rank],1,"#ABEBC6",2,"#F9E79F",3,"#FAD7A0",4,"#EDBB99")

vjingzhang_2-1646373578449.png

 

Format the background color based on Field value > Color column. 

vjingzhang_3-1646373843942.png

 

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

ebeery
Solution Sage
Solution Sage

@msimmonsmcse achieving what you're describing is not terribly straightforward, and probably is not possible using the built-in conditional formatting options.

However, the below video describes an approach to achieve this effect using some conditional formatting measures.

UNLEASH the full POTENTIAL of Conditional Formatting | ROW by ROW color scale in a MATRIX in PowerBI 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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