Difference between tuple and set in mdx

Searcher picture Searcher · Mar 1, 2012 · Viewed 27.7k times · Source

What is the difference between tuple and set in MDX. How we can distinguish both and when we are using them.

Answer

Preet Sangha picture Preet Sangha · Sep 12, 2012

Having come to MDX from a more maths perspective this is my take on the question:

Imagine you have 3d Cube with dimensions X, Y and Z. The number of cells in the cube is number of members in X multiplied by the number of members of Y multiplied by the number of members of Z.

Each cell with have a coordinate in the cube based on a value from X, Y and Z. That coordinate is a Tuple.

So lets say :

  • X is Measures,
  • Y is Years,
  • Z is Products,

Then a single cell could be the laptop sales for 1999. The cell coordinate will be: logically (X, Y, Z) and physically this is a tuple such as

(Measures.Sales, Years.[1999], Products.[Laptop])  

Now lets say we want multiple cells, then we need multiple tuples, right? Yes, a Set is basically multiple tuples. Actually by multiple I include 0 and 1. So extending our example, we could have laptops from 1999 and desktops from 2001:

{ 
    (Measures.Sales, Years.[1999], Products.[Laptop]) ,
    (Measures.Sales, Years.[2001], Products.[Desktop]) 
}

So you can see that you end up with multiple items with a set, and a single item with a tuple......