Search code examples
sql-serverssasmdxolap

The Axis0 function expects a tuple set expression for the argument. A string or numeric expression was used


I use SQL Server 2008 R2 and I use SSAS.

When I write the query below,

SELECT 
[Measures].[Internet Sales Amount] - [Measures].[Internet Standard Product Cost] ON COLUMNS,
[Customer].[Country].MEMBERS ON ROWS
FROM [Adventure Works]

I get this error

Executing the query ...

The Axis0 function expects a tuple set expression for the argument. A string or numeric expression was used.

Execution complete

what is my problem ?


Solution

  • An axis expression must contain a set of tuples that are defining the shape of the result; you are using a value instead. You should use a calculated measure as following :

    with member [Measures].[Profit] as 
      [Measures].[Internet Sales Amount] - [Measures].[Internet Standard Product Cost]
    SELECT 
      [Measures].[Profit] ON COLUMNS,
      [Customer].[Country].MEMBERS ON ROWS
    FROM [Adventure Works]
    

    Have a look to this page for a gentle introduction to MDX select statement.