2

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?

Paul White
  • 94,921
  • 30
  • 437
  • 687
Sir Swears-a-lot
  • 3,253
  • 3
  • 30
  • 48

2 Answers2

2

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.

Tom V
  • 15,752
  • 7
  • 66
  • 87
1

Some measures, even though they are numeric, makes no sense as SUM. Temp, Datekey (could be numeric) and others. The solution is to mark this measure as non-aggregate in the measure tab. This way it won't be aggregated.

Hila DG
  • 590
  • 2
  • 4