Skip to content

INTERSECTION

Description

The INTERSECTION function takes two lists and returns a new list containing only the elements that appear in both lists. Elements present in only one of the two lists are excluded from the result.

Syntax

INTERSECTION(list_a, list_b)

Returns: A list of elements that exist in both list_a and list_b.

Example

p is Person
INTERSECTION(p.countries_lived_in, p.nationalities)

This returns the countries the person has both lived in and holds a nationality for. For example, if a person has lived in Germany, Switzerland, and Italy, but only holds German nationality, the result would be [Germany].