The Filter function returns a set hence your error message:
https://msdn.microsoft.com/en-us/library/ms146037.aspx
Returns the set that results from filtering a specified set based on a search condition.
So you are trying to divide a set of members by a number.
To resolve it you need a numeric expression instead of a set. Numeric expressions are either of the following:
- A number
- A numeric measure
- A numeric formatted member property
- The result of a tuple
Probably number 4 is the trickiest concept in mdx
for someone new to the language to understand.
As @BillAnton has mentioned this is a tuple and hence a numeric expression:
([WORK ACTUAL].[MAINT D].&[PRO],[Measures].[Actual Hours])
This is also a tuple and numeric expression:
([WORK ACTUAL].[MAINT D].&[PRO])
It will simply use the measure that is used in the context of the script or the cubes default measure.
Also in the definition of Filter
you can see that it's signature is as follows:
Filter(Set_Expression, Logical_Expression )
In your script you have the following
Filter
(
[Measures].[Actual Hours] //<<measures are numeric_expression
,
[WORK ACTUAL].[MAINT D].[Maintenance Code] = 'PRO'
)
In terms of getting rid of the error here is 1 resolution:
IIF
(
//10 is a numeric placeholder (you can replace with something that returns a number)
10 / [Measures].[Actual Hours]
* 100
= 0
,0
,
//20 is a numeric placeholder (you can replace with something that returns a number)
20 / [Measures].[Actual Hours]
* 100
)