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,
Please view the below table:
The above table has two columns Lead and Contributor that I need to concatenate, removing any duplicates but keeping the brackets from the Lead column. The table also shows the Final column. It is this Final column that I need to produce using DAX.
If you look at each row you will see that the values from the Lead column, with their brackets, are always kept. Any names in the Contributor column that are also in the Lead column need to be removed. It is only the non-duplicated names that should be kept, without brackets.
I think the above table explains all clearly.
Hope do I achieve this?
Thanks.
Solved! Go to Solution.
Here is one way to do it. Add a custom column with this expression.
let
leadlist = Text.Split(Text.Replace(Text.Replace([Lead], "{", ""), "}", ""), ", "),
contriblist = Text.Split([Contributor], ", "),
removedupes = List.Distinct(List.RemoveMatchingItems(contriblist, leadlist)),
result = [Lead] & ", " & Text.Combine(removedupes, ", ")
in
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here is one way to do it. Add a custom column with this expression.
let
leadlist = Text.Split(Text.Replace(Text.Replace([Lead], "{", ""), "}", ""), ", "),
contriblist = Text.Split([Contributor], ", "),
removedupes = List.Distinct(List.RemoveMatchingItems(contriblist, leadlist)),
result = [Lead] & ", " & Text.Combine(removedupes, ", ")
in
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Can you share this sample file. I am facing problem to concatenate 2 strings without duplicates. Where should I need to write that Query. If am writing in Advanced editor I got error
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 |
---|---|
102 | |
101 | |
78 | |
70 | |
63 |
User | Count |
---|---|
141 | |
106 | |
101 | |
85 | |
72 |