The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
112 | |
80 | |
65 | |
48 | |
38 |