Power BI: match values between 2 columns then concatenate

In IT, particularly in the incident management, we have a parent column, and sometimes, I want to concatenate the child tickets:

power bi

NOTE: if I have another table, I can get the same result from this other table, at the end of the article, I explain how

To know if “number” is in “parent”, I will match them. I will add a new column:

power bi

Then put this formula:

IF(NOT(ISBLANK(LOOKUPVALUE('table'[argument1],'table'[argument1],'table'[argument2]))),"value")

power bi

NOTE: change table, argument1, argument2 and value by yours

Alternatively, I can use this formula if the one above is not working with your data:


var num=[argument2]
return
IF(COUNTROWS(FILTER('table',CONTAINSSTRING('table'[argument1],num)))>0,"value")
              
power bi

Next, I want to get a list of number tickets that share the same ID in the “parent” column. In fact, I will concatenate the “number” column based on the value in the “parent” one, I will need to match again the values between those 2 columns in order to get it with this formula:

IF(NOT(ISBLANK('table'[argument1])),CONCATENATEX(FILTER('table','table'[argument1]=EARLIER('table'[argument1])),'table'[argument2]," "))

power bi

NOTE: to separate the ticket number, for instance, by a coma instead of a space, change " " by ","

As you can see, INC004 is duplicate so to remove it:

IF(NOT(ISBLANK('table'[argument1])),CONCATENATEX(SUMMARIZE(FILTER('table','table'[argument1]=EARLIER('table'[argument1])),'table'[argument2]),'table'[argument2]," "))

power bi

Now if I want to have the results to be in the same row as the matching value of the “number” column, I just need to do those small changes to the formula:

power bi
power bi In case if I have 2 tables, and I want the result to display in the “Table2” instead of the “Table1”, there are again small changes to do, for instance: power bi
power bi
power bi

NOTE:

Interesting Topics