Facing error while working with Aggregate function in MDX (MultiDimensional-Expresson)

mdxssas

Hi everyone hope you're doing well

I'm using Aggregate function to aggregate the value of my measure
for two specific years as you can see below :

select aggregate ({[DimTime].[Year].&[1396] ,[DimTime].[Year].&[1397] },[Measures].[IndentCount]) on 0 from [Procurement]

according to the fact that aggregate function accepts two parameters :

Aggregate (Set_expression , Numeric_Expression)

What is wrong with my MDX query?

I get this error :

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

Thanks in advance

Best Answer

Look again at the details for the Aggregate() function. You got the parameters correct, but you need to look at what the function will return. It returns a numeric value.

So your MDX evaluates as SELECT some-numeric-value ON 0 FROM [Cube] which is not valid.

You need SELECT some-sort-of-set ON 0 FROM [Cube]

Try googling for examples of using this function (or see link above, which includes examples) to see how it can be used.

Related Question