Chapter 2. Working with Sets

In this chapter, we will cover the following recipes:

  • Implementing the NOT IN set logic
  • Implementing the logical OR on members from different hierarchies
  • Iterating on a set to reduce it
  • Iterating on a set to create a new one
  • Iterating on a set using recursion
  • Performing complex sorts
  • Dissecting and debugging MDX queries
  • Implementing the logical AND on members from the same hierarchy

Introduction

Sets in MDX are collections of tuples with the same dimensionality. As in many other programming languages, the basic logical operations, NOT, AND, and OR, can be applied on them.

When putting two tuples together to form a set, we basically ask for the results that contain any of those tuples. Therefore, sets in MDX naturally imply the ...

Get MDX with Microsoft SQL Server 2016 Analysis Services Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.