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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jeamps01
New Member

Color Code Text Values in Matrix

Is there a way that I can color code the values based on an "If Text contains" logic. Values in Matrix are in a text format.

 

For example, FLLFP would show up green in both columns and MIALL yellow in both columns, etc.

 

jeamps01_0-1637365631467.png

 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @jeamps01 ,

See the below sample:

base data:

vluwangmsft_0-1637633139427.png

Color measure:

COLOR = VAR TEST1=LEFT(MAX('Table'[value]),4)  RETURN IF(TEST1="FLLF","Green",IF(TEST1="MALL","Yellow",BLANK()))

Then:

vluwangmsft_1-1637633190812.png

vluwangmsft_2-1637633248563.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

Hi @jeamps01 ,

See the below sample:

base data:

vluwangmsft_0-1637633139427.png

Color measure:

COLOR = VAR TEST1=LEFT(MAX('Table'[value]),4)  RETURN IF(TEST1="FLLF","Green",IF(TEST1="MALL","Yellow",BLANK()))

Then:

vluwangmsft_1-1637633190812.png

vluwangmsft_2-1637633248563.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

speedramps
Super User
Super User

mycolour =
STRING(True(),
CONTAINSSTRING(tablename.fieldname, "FLLFP"), "green",
CONTAINSSTRING(tablename.fieldname, "MIALL"), "yellow",
BLANK()
)

Then in the matrix right click on Values > Conditional formating >  Backgground colour >
Format style = Field value

Based on = mycolour 

Thank you Speedramps. This doesn't work for some reason. STRING isn't a valid formula. I have SWITCH or SELECTEDMEASURESTRING as possible options.

 

Also my field name "Name + RGI" does not show up as a possible selection option for either of these formulas. I only see that Measures show up as possible options.

 

jeamps01_0-1637513389066.png

 

 

Sorry, for the autotext correction mistake.

Yes SWITCH should have been STRING !

😀

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors