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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
SelflearningBi
Helper III
Helper III

How to format multiple text columns

Model NameOD1OD2OD3OD4OD5
AYESYESYESNOYES
BNONONONONO
CYESYESNOYESYES


I have this table, and I would like to format the OD1 to OD5 column with color green and red. Yes is Green and No is Red. 

OD1 ~ OD5 are new columns I created. 
I know we can do if OD1 is Yes then 1 ad is No then 2 to do the formatting, but I have 5 columns then I would need to create 5 new columns. 

Is ther any easier way to do this ? 

1 ACCEPTED SOLUTION

Hi @SelflearningBi ,

 

Because each of your column names is different, Power BI Desktop can't make it easier to implement your needs.

The current system does not support this function. You can post your idea to Ideas .

https://ideas.powerbi.com/ideas/

 

Best Regards,

Neeko Tang

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

 

View solution in original post

4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @SelflearningBi ,

 

According to your description, you want to set the background color according to yes and no,right? Here are my steps you can follow as a solution.

 

(1)This is my test data.

vtangjiemsft_0-1665366243973.png

(2)We can create  measures.

 

 

_OD1= var _od1 =SELECTEDVALUE('Table'[OD1])

return

IF( _od1 = "YES" , "green" ,"red")

 

 

_OD2= var _od2 =SELECTEDVALUE('Table'[OD2])

return

IF( _od2 = "YES" , "green" ,"red")

 

 

_OD3= var _od3 =SELECTEDVALUE('Table'[OD3])

return

IF( _od3 = "YES" , "green" ,"red")
_OD4= var _od4 =SELECTEDVALUE('Table'[OD4])

return

IF( _od4 = "YES" , "green" ,"red")
_OD5= var _od5 =SELECTEDVALUE('Table'[OD5])

return

IF( _od5 = "YES" , "green" ,"red")

 

 

(3) Set the background color for the OD1-OD5 columns in turn as shown in the following figure.

vtangjiemsft_1-1665366243986.png

 

vtangjiemsft_2-1665366243989.png

 

(4) Then the result is as follows.

vtangjiemsft_3-1665366243991.png

For more information you can refer to this document Apply conditional table formatting in Power BI - Power BI | Microsoft Learn .

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

@v-tangjie-msft 
Hi, Thank you for helping me, This is a good way to do the formating;however, I was wondering is ther any method we are not required to create multip similar measures to achieve this formating? 

Hi @SelflearningBi ,

 

Because each of your column names is different, Power BI Desktop can't make it easier to implement your needs.

The current system does not support this function. You can post your idea to Ideas .

https://ideas.powerbi.com/ideas/

 

Best Regards,

Neeko Tang

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

 

Thank for answing 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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