Returns: A set.
The Intersect function compares two sets and then returns a set that consists of the members that exist in both of the specified sets. For example, the intersection of the sets { [A],[B],[C],[D] } and { [A],[C],[E] } is the set { [A],[C] }
By default, the Intersect function eliminates duplicate members from the combined set. However, by specifying ALL, you can retain the duplicate members in the set that the function returns
The following example uses the Intersect function to retrieve the sales amount for product departments with a name containing the words "GIRL" and "TEEN".
SELECT {[Price Analysis].[Measures].[Sales Amount]}
ON AXIS(0),
{Intersect(Filter([Price Analysis].[Product].[All Products].Children,
InStr([Price Analysis].[Product].CurrentMember.Name, "GIRL") > 0),
Filter([Price Analysis].[Product].[All Products].Children,
InStr([Price Analysis].[Product].CurrentMember.Name, "TEEN") > 0))}
ON AXIS(1)
FROM [Price Analysis]
| Product | Sales Amount |
|---|---|
| PETITE GIRL TEENS | 19611.68 |
| TEEN GIRLS | 35005.8 |
| TEEN GIRLS JEANS | 52952.56 |
You can perform basic set operations using the Union, Intersect, Except, and Crossjoin functions.