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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Comparing the cells and returning the result

Hi,

 

I have a dataset which is having two columns with "Yes" or "No" texts. I'd like to create a new column by comparing these two labels,

 

Ex: If either of the cells contains "Yes" then return the value "Yes" in the third column.

 

Happy to connect and provide more information.

 

Regards,

Prasanna Kumar K.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

This operation can be done in both DAX and Power Query.  If the Yes/No columns are coming directly out of your source data, then i'd suggesting completing this within Power Query.  If the Yes/No columns are being calculated on the basis of your data model itself (DAX Calculated Columns), then you'll need to do this within DAX itself.

 

Power Query Solution:

Go into Edit Queries and find the query that relates to the table with the yes/no columns.

Click on the last step of the "Applied Steps" and go into the Ribbon and select 'Add Column' -> 'New Custom Column'

Here you can build a simple formula to do what you need.  It should be something like:

if [Column1] = "Yes" or [Column2] = "Yes" then "Yes" else "No"

(Your column names will be different and the Yes/No could be either 0/1 or True/False.  Update approprately.

 

Dax Solution:

Rightclick on the table containing the Yes/No columns in the field picker on the right hand side of the screen.  Select 'New Column'

Put in a dax formula similar to this:

[Column3] = IF(
	[Column1] = "Yes" || [Column2] = "Yes",
	"Yes",
	"No"
)

Again change the names/values to suit your data.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This operation can be done in both DAX and Power Query.  If the Yes/No columns are coming directly out of your source data, then i'd suggesting completing this within Power Query.  If the Yes/No columns are being calculated on the basis of your data model itself (DAX Calculated Columns), then you'll need to do this within DAX itself.

 

Power Query Solution:

Go into Edit Queries and find the query that relates to the table with the yes/no columns.

Click on the last step of the "Applied Steps" and go into the Ribbon and select 'Add Column' -> 'New Custom Column'

Here you can build a simple formula to do what you need.  It should be something like:

if [Column1] = "Yes" or [Column2] = "Yes" then "Yes" else "No"

(Your column names will be different and the Yes/No could be either 0/1 or True/False.  Update approprately.

 

Dax Solution:

Rightclick on the table containing the Yes/No columns in the field picker on the right hand side of the screen.  Select 'New Column'

Put in a dax formula similar to this:

[Column3] = IF(
	[Column1] = "Yes" || [Column2] = "Yes",
	"Yes",
	"No"
)

Again change the names/values to suit your data.

Anonymous
Not applicable

Hello,

 

I'd like to put one more que here. Let say, my requirement is to consider "yes"or "no" using two existed columns(which were created using LOOKUPVALUE formula from another table in the same dataset).

I need to create a new column with the values "yes" or "no", if any one column (columns mentioned above) contains "yes" then it should give me the result "yes".

 

Ex: if both the columns conatains 'yes' then the result should be 'yes'

     if one column contains 'yes' and another contains 'no' then the result should be 'yes'

     if one column contains 'no' and another contains 'yes' then the result should be 'yes'

     if both the columns conatains 'no' then the result should be 'no'

 

Is there any formula to create a column like this?

Anonymous
Not applicable

Based on how you have written that, I would expect the existing solution would do exactly that.

Anonymous
Not applicable

Thanks Dear. It worked.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors