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

Show correct column based on its value

Hello, 

 

I am trying to create a plain table in Power BI but I am having trouble figuring out how to add a column based on values from basically two columns. I am getting duplicate rows since the rows are unique so I need to filter them out based on the value in col1.

 

Let's say I have two columns; col1 and col2

If col1 contains the string "See col2" then I want to show col2,

if col1 does not contain "See col2" then show col1 value.

 

 

Thanks for your time.

Br,

Sandra 

1 ACCEPTED SOLUTION
bhelou
Responsive Resident
Responsive Resident

Hello , 

give this a try 


New Column =
IF(
CONTAINSSTRING(Table1[col1], "See col2"),
Table1[col2],
Table1[col1]
)
& " " &
IF(
CONTAINSSTRING(Table1[col1], "See col2"),
"",
DISTINCT(Table1[col1])
)

Regards, 
Please consider accepting this as a solution !! Respect your KUDO !! 
I appreciate your recognition and feel proud to have been able to assist you.


View solution in original post

1 REPLY 1
bhelou
Responsive Resident
Responsive Resident

Hello , 

give this a try 


New Column =
IF(
CONTAINSSTRING(Table1[col1], "See col2"),
Table1[col2],
Table1[col1]
)
& " " &
IF(
CONTAINSSTRING(Table1[col1], "See col2"),
"",
DISTINCT(Table1[col1])
)

Regards, 
Please consider accepting this as a solution !! Respect your KUDO !! 
I appreciate your recognition and feel proud to have been able to assist you.


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