Forum Discussion
Searching a column in table A using data from a column in table B
- Anonymous2 years ago
Hi Anonymous
"Custom1" is not created with adding a custom column. It is created in the formula bar directly just like below. You can right click #"Renamed Columns2" step, select "Insert Step After" then modify the code in the formula bar.
For the second step, it is created with adding a custom column. But it is not based on the "Custom1" step. Instead, it is based on the previous step of "Custom1". You need to modify the step name.
You can also edit the code in Advanced editor directly. It looks like this.
Best Regards,
Jing
Are you guaranteed to have a hashtag before the value?
If so, could you create a custom column like this that extracts the first string following a hashtag, then do a left join on that column (given the fact that you said the second table is guaranteed to have only one match), or at least get rid of the necessity to "search" the string, and instead you can just match it exactly using a calculated column if you don't want to merge or join the tables?
In either case I think this would simplify things.
ā
I wish that was the case, but no, it might or might not be there.
- Anonymous2 years agoNot applicable
Hi Anonymous
You may try my solution as below. I also attached a demo pbix at bottom. Hope this would be helpful.
Table A:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8vJ3VvBNrMxXcM7JzMtMVlB2dHI2NFIILE0sKkktyqlU8E1NLcnMS1eK1cGh2ASb4lgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Subject = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Subject", type text}}), Custom1 = List.Zip({#"Table B"[Name],#"Table B"[ID]}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let vSubject = [Subject] in List.Last(List.First(List.Select(Custom1, each Text.Contains(vSubject, _{0}))))) in #"Added Custom"Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!- Anonymous2 years agoNot applicable
Ive been trying to get this to work but running into an expression error.
= Table.AddColumn(#"Renamed Columns2", "SFID", each let vsubject = [Subject] in List.Last(List.First(List.Select(Custom1, each Text.Contains(vSubject, _{0})))))
Expression.Error: The name 'vSubject' wasn't recognized. Make sure it's spelled correctly.
- Anonymous2 years agoNot applicable
The custom list also broke my visuals as I have other columns that are referenced.