Power BI: match values between 2 columns then concatenate

In IT, particularly in the incident management, we have a parent column, something like that:

power bi

The “number” column has unique values but the “parent” one contains duplicates. 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, again, I will need to match the values between those 2 columns in order to get it with this formula:


var num=[argument1]
return
IF(NOT(ISBLANK(num)),CONCATENATEX(FILTER('table','table'[argument1]=num),'table'[argument2]," "))
              
power bi

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

power bi

NOTE: for the column 3 to know how many tickets, read Power BI: count number of characters/letters/words using a column

I have all the information I need so I can stop here but let’s go a little further. I need to have the results of the column 3 to be in the same row as the matching value of the “number” column. To do that, I will create another table:

power bi

To extract the unique values of the “parent” column:

power bi

NOTE: for more information, read Power BI: extract columns from a table to another one

Next, I will add a column to get the list:

power bi

NOTE: for more information, read Power BI: combine words based on criteria

Now, to make appear the list in the table1, either I will use:

  • The LOOKUPVALUE function (no relationship)
    power bi
  • Or the RELATED function (relationship)
    power bi power bi

In both cases, it will be the same result:

power bi

Interesting Topics