Search code examples
mdxcubeolap-cube

MDX - With Member not working when more than one attribute added


I seem to have a problem when I try and add more than one Quarter attribute. The following works no problem.

with member [Measures].[myTest] as
([Measures].[sample],
 [Date].[Fiscal Date].[Fiscal Year].&[1415],
 [Date].[Quarter].&[Jul-Sep]
 ),
format_string='$#,###,###,##0'
SELECT NON EMPTY 
{...

Now when I try and add one more quarter as a set I get:

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

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

This is how I’m doing the [Date].[Quarter] set.

with member [Measures].[myTest] as
([Measures].[sample],
 [Date].[Fiscal Date].[Fiscal Year].&[1415],
 {[Date].[Quarter].&[Jul-Sep], [Date].[Quartr].&[Oct-Dec]}
 ),
format_string='$#,###,###,##0'
SELECT NON EMPTY 
{...

Can I have more than one [Date].[Quarter] attribute?


Solution

  • Looks like you have a typo John: [Date].[Quartr].&[Oct-Dec]

    Try aggregating the two quarters before creating your new measure:

    WITH 
      MEMBER [Date].[Quarter].&[Jul-Dec] AS 
        Aggregate(
           {[Date].[Quarter].&[Jul-Sep]
           ,[Date].[Quarter].&[Oct-Dec]}
        ) 
      MEMBER [Measures].[myTest] AS 
        (
          [Measures].[sample]
         ,[Date].[Fiscal Date].[Fiscal Year].&[1415]
         ,[Date].[Quarter].&[Jul-Dec]
        ) 
       ,format_string = '$#,###,###,##0' 
    SELECT 
      NON EMPTY