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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
antoniasoter
Regular Visitor

conditional formatting text that contains

Hi guys

I have a table in power bi where few of the columns i have contain the following values

Started

In progress

Deferred

Completed

 

I need to colored the cells depending on the values about for example yellow,blue,orange,green. I looked everywhere but havent found any solution.The only thing i found is creating a custom column assign specific values for each of the above and then use the conditional formatting.But i dont want extra column next to it.

 

Is there any workaround to achieve what i want?

 

 

1 ACCEPTED SOLUTION

Conditional formatting has only been available for a few months, and is nowhere  near as mature as in Excel. You can't write your own rules unfortunately. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

4 REPLIES 4
IrfanM
Regular Visitor

For doing the conditional formatting based on some text, i have come up with an solution, little round way but it should work.

 

For the above example -  of Column Status, suppose you have below expected text.

Started

In progress

Deferred

Completed

 

First create images for all these text with your preferred color and save as Started.PNG etc.

Create a new column with serching these value into the Column and reference the images as we URL as below -

CalculatedStatus = SWITCH(
       TRUE(),
       SEARCH("Started", [Status], 1, 0) > 0, "http://localhost/images/Started.png",
       SEARCH("In Progress", [Status], 1, 0) > 0, "http://localhost/images/InProgress.png",
       SEARCH("Deferred", [Status], 1, 0) > 0, "http://localhost/images/Deffered.png",
       SEARCH("Completed", [Status], 1, 0) > 0, "http://localhost/images/Completed.png","http://localhost/images/Blank.png")

 

This will create a new Column - CalculatedStatus with all URL of images you created above.

Goto Modeling option from PowerBI Desktop for that Column and convert this type to Image URL.

Publish it by using the new Column into your reports and you would be having colorful status.

 

Note: Sometime you don't see the images into PowerBI Desktop app, but published report will show the images.

 

juanca
Helper II
Helper II

Hi antoniasoter,

 

I'm looking for applying condional formattin in a true/false field and it seems not possible by now...

 

Anyway, I am curious about your comment: "The only thing i found is creating a custom column assign specific values for each of the above and then use the conditional formatting"

 

I don't know how to do it with a true/false (or a text field in general) field, could you explain this solution please?

Thank you very much for your answer or anyones answer.

 

Best regards!

Conditional formatting has only been available for a few months, and is nowhere  near as mature as in Excel. You can't write your own rules unfortunately. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Pls vote for improvements in conditional formatting here: https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/14458686-table-conditional-format...

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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