Forum Discussion

Bublic's avatar
Bublic
New Member
5 years ago
Solved

Add Column based on other table columns value

Hi!

Need your help with simple task..

 

I have 2 tables with no relations between them:

#Table1({"ColumnA", "ColumnB"}, {{1,Green Apple },{2,Red Potato},{3,Blue Star},{4,Kung Fu Panda}})  

#Table2({"ColumnC", "ColumnD"}, {{apple, fruit},{potato, vegetable},{star, astronomical object},{kung fu, martial art}}) 

 

The goal is to add ColumnE to Table1 with this condition:

if Text.Contains(Table1[ColumnB, Table2[ColumnC]) then Table2[ColumnD] else null 

 

The result should be:

#Table1({"ColumnA", "ColumnB","ColumnE"}, {{1,Green Apple , fruit},{2,Red Potato, vegetable},{3,Blue Star, astronomical object},{4,Kung Fu Panda, martial art}})  

 

This perfectly works with manual static if blocks, but I have no idea how to automate this task using values from table.

 

Any ideas?

 

6 Replies