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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Conditional Formatting - FieldColor measure based on mutiple criteria

Hi!

With release of August update, we can color by Field Value and that includes Measure. I have a requirement where I need to compare Multiple values and color my cells accordingly.
Eg: When showing Sales in a Matrix by Region (Rows) and Products (Column),
I want to use different color codes for combination of Region and Products and Sum of Sales . I am just not getting it 😞


Here is what I tried (its obviously incorrect, how can I refer the incoming filters for current row?):

ColorCell = Switch(true(),
[Sales] <=500&& Table[Region]="EUROPE" && Table[Product]="Product 1"  ,"#b200ff",
[Sales]<=500 && Table[Region]="ASIA" && Table[Product]="Product 2" ,"#0000b2",
[Sales]<=500 && Table[Region]="AMERICAS" && Table[Product]="Product 2" ,"#b200cc")

 

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

I have made a test with the data sample similar with yours and create the measure similar with yours.

 

ColorCell =
SWITCH (
    TRUE (),
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "EU"
        && MAX ( 'Sheet100'[Attribute] ) = "P1", "#b200ff",
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "AS"
        && MAX ( 'Sheet100'[Attribute] ) = "P2", "#0000b2",
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "AM"
        && MAX ( 'Sheet100'[Attribute] ) = "P2", "#b200cc"
)

Here is the ouput which I think that is right.

result output.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

I have made a test with the data sample similar with yours and create the measure similar with yours.

 

ColorCell =
SWITCH (
    TRUE (),
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "EU"
        && MAX ( 'Sheet100'[Attribute] ) = "P1", "#b200ff",
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "AS"
        && MAX ( 'Sheet100'[Attribute] ) = "P2", "#0000b2",
    SUM ( Sheet100[Value] ) <= 500
        && MAX ( 'Sheet100'[Type] ) = "AM"
        && MAX ( 'Sheet100'[Attribute] ) = "P2", "#b200cc"
)

Here is the ouput which I think that is right.

result output.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you Cherry!!

I swear I did that same (but with MIN() ) 😄
When I went back to my old version I realized I was using a wrong region column

Thank you so much, you wont beleive how many Google search I did to find a solution. Posting here was the last restore and I should have done it first 🙂

Hi @Anonymous,

 

You're welcome!Smiley Very Happy

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.