Forum Discussion

antoniasoter's avatar
antoniasoter
Regular Visitor
9 years ago
Solved

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?

 

 

  • 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. 

4 Replies

  • IrfanM's avatar
    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.

     

  • MattAllington's avatar
    MattAllington
    Icon for Community Champion rankCommunity Champion

    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. 

  • 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!