Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have two columns and would like to create a new column that would show how similar are the two columns. The order of the words does not matter. If all words are contained in Name2 from Name1, it would be 100% match. i.e below
Name1 | Name2 | Similarity_% (New column) |
Pepsi Co | Pepsi Co | 100% |
Co Pepsi | Pepsi Co | 100% |
Pepsi Co LTD | Pepsi Co | 90% |
Pepsi Co | Cola | 0% |
Thanks,
Daven
Solved! Go to Solution.
If you're doing this in the query editor, you can write a custom column with this formula
let
a = List.Distinct(Text.Split([Name1], " ")),
b = List.Distinct(Text.Split([Name2], " "))
in
List.Count(List.Intersect({a, b})) / List.Count(a)
This gives the fraction of the number of words that the names share divided by the number of words in Name1 (so 67% for your 3rd row--I don't know where your 90% came from).
This is likely possible in DAX but more difficult without an analog for Text.Split.
If you're doing this in the query editor, you can write a custom column with this formula
let
a = List.Distinct(Text.Split([Name1], " ")),
b = List.Distinct(Text.Split([Name2], " "))
in
List.Count(List.Intersect({a, b})) / List.Count(a)
This gives the fraction of the number of words that the names share divided by the number of words in Name1 (so 67% for your 3rd row--I don't know where your 90% came from).
This is likely possible in DAX but more difficult without an analog for Text.Split.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |