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
DavidMG82
Frequent Visitor

Bar Chart, Bar color by formula text contains

Hi everyone, im currently working with the formula below having good results for specific text contain on a field, but what if I would like to color green all the fields that contains the word "Yes", any advice will be very appreciated. Thanks ahead.

 

barColor = SWITCH(
   
    TRUE(),
   
    MIN('IGAnswers'[Answer1]) = "Yes", "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Completed", "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Partially", "#F4C430",
    MIN('IGAnswers'[Answer1]) = "No", "#BC204B",
    MIN('IGAnswers'[Answer1]) = "Not Completed", "#BC204B",
    "#D3D3D3"

)
1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @DavidMG82 
Try to modify your formula to :

barColor = SWITCH(
   
    TRUE(),
   
   
 CONTAINSSTRING(MIN('IGAnswers'[Answer1]),"Yes") = TRUE(),  "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Completed", "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Partially", "#F4C430",
    MIN('IGAnswers'[Answer1]) = "No", "#BC204B",
    MIN('IGAnswers'[Answer1]) = "Not Completed", "#BC204B",
    "#D3D3D3"

OR just use generic conditional options of the UX:
Ritaf1983_0-1686711671900.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

View solution in original post

3 REPLIES 3
DavidMG82
Frequent Visitor

Thanks @Ritaf1983 , I should have explored more on the default options, have a great day.

Hi @DavidMG82

I was happy to assist,  please consider Accepting it as the solution to help the other members find it more quickly

Ritaf1983
Super User
Super User

Hi @DavidMG82 
Try to modify your formula to :

barColor = SWITCH(
   
    TRUE(),
   
   
 CONTAINSSTRING(MIN('IGAnswers'[Answer1]),"Yes") = TRUE(),  "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Completed", "#00A3A1",
    MIN('IGAnswers'[Answer1]) = "Partially", "#F4C430",
    MIN('IGAnswers'[Answer1]) = "No", "#BC204B",
    MIN('IGAnswers'[Answer1]) = "Not Completed", "#BC204B",
    "#D3D3D3"

OR just use generic conditional options of the UX:
Ritaf1983_0-1686711671900.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

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.