Forum Discussion
Merge 2 tables using similar data to match
- 5 years ago
Ironpixel , Try a new column in Dax Like this
maxx(filter(Table2, search(table2[Team Number], table1[eam Number],,0)>0),Table2[Team Name])
- 5 years ago
Hi, Ironpixel , you might want to try such a solution,
let Lookup = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc47CoAwEATQq8jWgSXsN6W/G9iFFBaW3r81opIiYDcMj2Fyhu3Yz2GEABhJTFBdiB09aYoEJbxi6kQkV25gfoCJfUDZqWYmxaRO1uzSj3kVdyXa2Po3SV4PQCkX", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Team Name" = _t, #"Team Number" = _t]), Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fcuxCgJBDIThd0l9EMIk2dnWwsJXWLY7wYPjBN+/MJ7Y2gQy/N8Ycns+DllEDdFCkwGnsmc3KJiEZhCuXk/KXIZcX/f1K1q0n0j/lHSk9kJNYQTPe6LLtu//EGiVOyzZa4JVWZPM+QY=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User Name" = _t, #"Team Number" = _t]), Matchup = Table.AddColumn( Source, "Team Name", each List.Accumulate( Table.ToRecords(Lookup), {[Team Number], {}}, (s, c) => if Text.Contains(s{0}, c[Team Number], Comparer.OrdinalIgnoreCase) then {s{0}, s{1}&{c[Team Name]}} else s ){1} ), #"Expanded Team Name" = Table.ExpandListColumn(Matchup, "Team Name") in #"Expanded Team Name"
Hi Ironpixel ,
Based on your description, you can create a measure or a calculated column as follows.
- Measure:
Measure_match =
MAXX(
FILTER(
'Case1_2',
SEARCH(
'Case1_2'[Team Number],
MAX('Case1-1'[Team Number]),
,
0
)>0
),
[Team Name]
)
- Calculated column:
Match_column =
SWITCH(
TRUE(),
SEARCH("896913",'Case1-1'[Team Number],1,0)>0,"Team A",
SEARCH("13864",'Case1-1'[Team Number],1,0)>0,"Team B",
SEARCH("96837",'Case1-1'[Team Number],1,0)>0,"Team C",
SEARCH("13556",'Case1-1'[Team Number],1,0)>0,"Team D",
SEARCH("38138",'Case1-1'[Team Number],1,0)>0,"Team E",
"No"
)
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.