Difference between tuple and set in mdx

前端 未结 4 2064
半阙折子戏
半阙折子戏 2021-02-07 14:45

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

4条回答
  •  天涯浪人
    2021-02-07 15:04

    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......

提交回复
热议问题