Implementing unary operators
Unary operators are a way to bypass custom rollups in parent-child dimensions. Custom rollups, either built-in or the ones we created one recipe before, use MDX expressions to calculate the value of a member that has it defined. Unary operators use a simple character, most commonly a +
, -
, or ~
sign to instruct SSAS how that member aggregates into its parent. A plus means it is added, minus subtracted, and ~
means it doesn't aggregate at all.
Look at the last screenshot in the previous recipe. Item # of Orders is the aggregated value of two of its children. However, all three of them, that item and its children have MDX expressions that tell which value to display. We can simplify this. Instead of specifying an MDX formula for # of Orders, we can simply put + unary operator for its children.
Let's test this!
Getting ready
Open the Metadata.xlsx
file that you used in previous recipes. Fill in the UnaryOperator column based on the following table:
ID |
Name |
Unary Operator... |