Searching one aggregate list for any values in another aggregate list

I'm trying to use a table calculation to check two lists against one another, and relay whether there was a full, partial, or no match for values in Aggregate List 2 appearing in Aggregate List 1. Working Table Calculation column name is 'Match?'.

Example output:

  • List 1: Red                               List 2: Red              Match?: Full Match
  • List 1: Red, Blue, Green        List 2: Red, Blue     Match?: Partial Match
  • List 1: Red, Green                 List 2: Red, Purple Match?: Partial Match
  • List 1: Purple, Black            List 2: Blue, Red     Match?: No Match

My trouble currently is example row 3, where one item from list 2 matches, but another does not. Currently, this results in 'No Match', which I've hesitantly switched to "If more than 1 item in list, then return "Cannot Eval"".

I'd like to be able to accurately search Aggregate List 1 against all comma separated values in the Aggregate List 2, and if any are found to match, return "Partial Match".

Current Table Calculation:

 

if(${list_1}=${list_2},"Full Match",
if(contains(to_string(${list_1}),to_string(${list_2})),"Partial Match",(
if(${list_2_count}>1,"Cannot Eval","No Match"))))

 

I then attempted to replace:

 

to_string(${list_2})

 

with:

 

to_string(split(${list_2},","))

 

But only received "No Match" for the rows with the challenging condition (example row 3 above).

I think I need something more extensive to instead search each successive list value, potentially involving substring, but I am not certain.

A key factor here is that list_1 and list_2 can be any number of comma separated values long, up to 10 values, and I do not know how to accommodate this. I do have a measure for list_2_count that returns the number of values in list_2.

0 1 375
1 REPLY 1
Top Labels in this Space
Top Solution Authors