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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sridhar71
Helper I
Helper I

Conditional formatting for each matrix row

I have a Matrix table that shows Inventory turnover for each Vendor.

I want to know If I have different conditions for each Vendor.

For Ex if the value or Vendor1 >= 300 then use orange but for Vendor2 use Green

If the value goes below 100 for Vendor 4 then use red but do not apply the same rule for other vendors.

sridhar71_0-1667327027362.png

 

Let me know if this is possible

1 ACCEPTED SOLUTION

I have uploaded a test .pbix file that are working.

Does not look like I have possibilites to upload the file. If needed, I can email it to you. Please let me know.


My measure looks like this: (Could you try to change yours as well, and use AND () instead of &.

Color measure =
SWITCH (
    TRUE(),
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor1", SUM ( 'Table'[Value] ) = 100 ), "#e30b5d",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor2", SUM ( 'Table'[Value] ) = 200 ), "#8e4585",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor3", SUM ( 'Table'[Value] ) = 150 ), "#077106",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor4", SUM ( 'Table'[Value] ) = 300 ), "#09387f",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor5", SUM ( 'Table'[Value] ) = 200 ), "#5851db"
)
 
I have added a snipping tool of the result, and it works as expected.
mariussve1_0-1667332761995.png

 

Br

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

View solution in original post

12 REPLIES 12
sridhar71
Helper I
Helper I

This is the measure I created.

sridhar71_0-1667331694878.png

 

It is located under the main table.

What do you mean by "put the measure in the matrix"?

In the table/matrix where you gonna have the conditional formatting, put the color measure in the value field. Just to ensure its not throwing a error measure.

This is for debugging purpose only


Br
Marius
BI Fabrikken
www.bifabrikken.no

This is the error I got

"Calculation error in measure 'npa_invtry_qty'[Color measure]: DAX comparison operations do not support comparing values of type True/False with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values."

 

This is my DAX

Color measure =
SWITCH ( TRUE(),
SELECTEDVALUE (npa_invtry_qty[INVTRY_STATUS]) = "Forecast" & [Total Quantity New]>= 300, "#F3F2F1",
SELECTEDVALUE (npa_invtry_qty[INVTRY_STATUS]) = "Actual" & [Total Quantity New] >= 200, "#666666"
)
 
Total Quantity New is a Measure
 

I have uploaded a test .pbix file that are working.

Does not look like I have possibilites to upload the file. If needed, I can email it to you. Please let me know.


My measure looks like this: (Could you try to change yours as well, and use AND () instead of &.

Color measure =
SWITCH (
    TRUE(),
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor1", SUM ( 'Table'[Value] ) = 100 ), "#e30b5d",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor2", SUM ( 'Table'[Value] ) = 200 ), "#8e4585",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor3", SUM ( 'Table'[Value] ) = 150 ), "#077106",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor4", SUM ( 'Table'[Value] ) = 300 ), "#09387f",
    AND ( SELECTEDVALUE('Table'[Vendor]) = "Vendor5", SUM ( 'Table'[Value] ) = 200 ), "#5851db"
)
 
I have added a snipping tool of the result, and it works as expected.
mariussve1_0-1667332761995.png

 

Br

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

You are a genius.

 

it is working now

sridhar71_0-1667333357889.png

 

please email it to sramaswamy71@gmail.com

I have now emailed you the working .pbix file as agreed 🙂

Br

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no
mariussve1
Super User
Super User

Hi,

You can create a measure to be used with conditional formatting;

 

Color measure =
SWITCH ( TRUE(),

SELECTEDVALUE (Table[In charge]) = "Vendor1" & SUM(Table[ValueColumn]) >= 300, "#F3F2F1",

SELECTEDVALUE (Table[In charge]) = "Vendor2" & SUM(Table[ValueColumn]) >= 200, "#666666"

)

 

Br

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

Thanks for reply.

 

How will the measure be applied after we create it?

Hi again,

 

When you are in the conditional formatting pane you need to choose field value in the format style:

 

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color...

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

I tried that and it is not letting me choose the measure as an option

sridhar71_0-1667331395336.png

 

After I click on Color Measure

sridhar71_1-1667331417616.png

 

Can you put the measure in the Matrix and ensure there is no error in it? When I have the issue of choosing measure in the field value its because the measure has error in it

 

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.