Forum Discussion
CoronaAustralis
4 years agoFrequent Visitor
Return value if cell contains text in another column
Hi Experts, How to return value if cell contains any text in another column in the same table ? There are duplicates value in Group 1 & Group 2. Do not suggest split into two table and merge q...
- 4 years ago
Hi CoronaAustralis ,
Here two solutions.
In Power Query:Here the code:
= Table.AddColumn(#"Changed Type", "Custom", each if List.Contains(#"Changed Type"[Group 1] , [Group 2]) = true then "Yes" else null)
For reference:
In DAX:Here the code:
Return Value = IF ( CONTAINS ( Table9, Table9[Group 1], Table9[Group 2] ), "Yes", BLANK() )
For reference:
Hope this helps!
/Tom
Alex_T
4 years agoFrequent Visitor
Hi CoronaAustralis ,
Is this any good...
let
fnContains_duplicates = (_list as list, _value as text) as text => if List.ContainsAny(_list,{_value}) then "Yes" else "No",
Source = #"Your table here",
column_asList = Source[Group 1],
#"Added Custom" = Table.AddColumn(Source, "Duplicate", each fnContains_duplicates(column_asList,[Group 2]))
in
#"Added Custom"
Edit: Sorry, hadn't previously read to the bottom of the page so I've just seen that this is similar to a tackytechtom solution, don't know if this variation would resolve the cyclic reference?