Pavel Voronin
Pavel Voronin

Reputation: 13983

What does an MDX query return?

I just started learning SSAS and cannot understand the basic idea.

What happens when query fixes fewer dimensions than cube has?

All examples usually present queries where intersection of dimensions gives either a point or an axis; in the former case we have the value and in the latter one we get some aggregated value.

Yet I cannot understand what happens when fixed dimensions produce a cube with fewer dimensions. What will be the result of such query?

Upvotes: 1

Views: 281

Answers (2)

Andrey Ershov
Andrey Ershov

Reputation: 1803

I'll try to explain it simplier, then the previous answer.

In SELECT statement you define a 'space' more like mathematical space of result. The whole cube is being projected on that space using aggregation functions.

If you want to project part of the cube you use a WHERE clause.

That's the key defference between SQL which was hard for me to grasp in the beginning:)

Upvotes: 3

whytheq
whytheq

Reputation: 35557

An MDX query actually returns a cube - well a sub-cube.

I suppose this is enough to show it in action:

SELECT 
  NON EMPTY 
    {
      [Measures].[Internet Order Count]
    } ON COLUMNS
 ,NON EMPTY 
    {
        [Sales Territory].[Sales Territory].[Country].MEMBERS
      * 
        [Date].[Calendar].[Month].ALLMEMBERS
    } ON ROWS
FROM 
(  //>>>>>>following is a sub-select>>>>>
  SELECT 
    [Date].[Calendar].[Month].&[2008]&[1] ON COLUMNS
  FROM [Adventure Works]
);

The section I've marked is a sub-select which returns a cube. That cube is then further queried by the outer script.

If a cube is returned then why do we just see a table of values? Returning a cube and what is actually visible are two different things. All dimensions are used whenever we run an mdx script - if we do not explicitly use the dimension in our script then it is evaluated at the [(All)] level. So even when only a small table is shown by say ssms all the dimensions are being returned by the script and then only certain aspects are being made visible via what is specified in your script.

Upvotes: 1

Related Questions