Forum Discussion
Vlook Up and Textjoin with DAX Syntax
Hello,
I was wondering if you can help me with the following issue.
I currently have detailed table with a lot information which includes a column with ID's and a column with Countries among others like the below:
| ID | Country | Names |
| U01 | Australia | ## |
| U01 | Germany | ## |
| U01 | Australia | ## |
| U02 | Italy | ## |
| U02 | United Kingdom | ## |
| U03 | United Kingdom | ## |
| U03 | Spain | ## |
| U04 | Poland | ## |
Now, I have created with DAX syntax a new table (Listed Countries) that will return the unique list in a column of the ID's available in the first table (Countries) with the following code:
| ID | Countries |
| U01 | Australia, Germany |
| U02 | Italy, United Kingdom |
| U03 | United Kingdom, Spain |
| U04 | Poland |
Any suggestions as to how to achieve the above outcome?
Thanks
Hello,
I actually managed to find a solution within this topicSolved: Concatenate only unique strings in measure - Microsoft Power BI Community
Thanks
6 Replies
- KostasHelper IV
Hello,
I actually managed to find a solution within this topicSolved: Concatenate only unique strings in measure - Microsoft Power BI Community
Thanks
- AllisonKennedyCommunity Champion
Kostas The DISTINCT function in DAX already removes the blank row created by relationships, so you may not need such a long formula for that table.
https://docs.microsoft.com/en-us/dax/distinct-function-dax
That aside, the CONCATENATEX function is likely what you're looking for here:
https://excelwithallison.blogspot.com/2021/03/data-story-of-month-employee-form.html
Very similar to the scenarion in my blog above.
- KostasHelper IV
Hello AllisonKennedy and thanks for your reply.
I have already explored the option of using the ConcatenateX function but the issue that I am having is that it returns all the times that a value appears in the countries column instead the unique values.
For example, when I am using it, based on the example below for the ID U01, I will get the following outcome:
ID Countries
U01 Australia, Germany, Australia.
Is there a way to return me the unique list (or distinct) of values within the single cell as following:
ID Countries
U01 Australia, Germany
Thanks
- AllisonKennedyCommunity Champion
Kostas It should work if you use CONCATENATEX on the distinct country list. Can you share sample file or at least the DAX and data model screenshot?
You may need to create a DimCountry table that lists each country only once, then use CONCATENATEX on that table, and filter for ID IN ListedCountries[ID]
Does that make sense?