SSAS Calculated measure with SCOPE.

mdxssasssas-2016

I'm building an SSAS OLAP cube on Meteorological data. Some of this data can be totaled (eg rainfall) and some can't (like wind direction).

I want totals, but only on data sources where it makes sense. (Where the interpolation method = 3.)

I've tried adding SCOPE with this:

SCOPE ([Measures].[Total]); 
SUM([Data Source].[Interpolation Method].&[3],[Measures].[Total]); 
END SCOPE; 

And get warnings:

Invalid query syntax. A valid MDX or DAX query was expected

and:

One or more errors were encountered in the MDX script

What am i missing?

Best Answer

I don't have your SSAS database so I can't test the syntax, but I believe you would need to write your MDX as follows (notice the THIS= addition):

SCOPE ([Measures].[Total]); 
THIS = SUM([Data Source].[Interpolation Method].&[3],[Measures].[Total]); 
END SCOPE; 

See the documentation for syntax details.