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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Looking for a way to show a Custom Column that says Yes if a Value From Row is in Entire Column.

Hello. I'm trying to add a custom column that says
 
if (value in row) is in (entire column) then YES else NO.
 
Is this possible without using Merge?
2 ACCEPTED SOLUTIONS
artemus
Microsoft Employee
Microsoft Employee

Sure...

if List.Contains(MyTable[SomeColumn], [RowValue]) then
   "YES"
else
   "NO"

View solution in original post

v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have created a sample for your reference, please check the following steps as below.

1. Convert the column to list as below.

Capture.PNG

 

2. Then we can add a custom column in the table.

=if List.Contains(Table, [RowValue]) then "Yes" else "No"

3.PNG

 

M code for your reference.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1QGSECoJTKakpCjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [RowValue = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"RowValue", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if List.Contains(Table, [RowValue]) then "Yes" else "No")
in
    #"Added Custom"

 

Attached the pbix as well.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

9 REPLIES 9
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have created a sample for your reference, please check the following steps as below.

1. Convert the column to list as below.

Capture.PNG

 

2. Then we can add a custom column in the table.

=if List.Contains(Table, [RowValue]) then "Yes" else "No"

3.PNG

 

M code for your reference.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1QGSECoJTKakpCjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [RowValue = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"RowValue", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if List.Contains(Table, [RowValue]) then "Yes" else "No")
in
    #"Added Custom"

 

Attached the pbix as well.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

THANK YOU!!!

artemus
Microsoft Employee
Microsoft Employee

Sure...

if List.Contains(MyTable[SomeColumn], [RowValue]) then
   "YES"
else
   "NO"
Anonymous
Not applicable

Thank you @artemus .  I get errors when trying this. 

 

Expression.Error: We cannot convert the value "Row Value" to type List.   

 

 

I'm working with 100k rows of data.

What are you putting in for MyTable?

 

It should be the name of the previous step in your query.

Anonymous
Not applicable

Thank you @artemus .  I was using the table name.

 

I replaced with previous step and i'm getting an error

 

= Table.AddColumn(#"Expanded DATA_REPEAT", "Caused_A_Repeat", each if List.Contains(#"Expanded DATA_REPEAT",[TICKET_NUMBER], [1st_Ticket]) then "YES" else "NO")

 

Unexpected Error:

There was an error deserializing the evaluation results. The operation might succeed on a retry.

Remove the comma between:

#"Expanded DATA_REPEAT",[TICKET_NUMBER]

Anonymous
Not applicable

Thank you again! @artemus 

 

My file has so many rows of data i think it's unable to perform this lookup. 

Is there a reason why a self merge will not work for 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