The CREATE MEMBER statement allows the creation of calculated members.
You can define a calculated member for use by a single query with the WITH clause in the SELECT statement, or for use in multiple queries in a session with the CREATE MEMBER statement. For more information about WITH, see Using WITH to Define Calculated Members, Sets, and Cache.
A newly created calculated member can have several properties such as SolveOrder. The syntax allows setting these properties.
<create-member-statement> ::= CREATE <optional-scope> <create-member-subset> [<create-member-subset>...]
<create-member-subset> ::= MEMBER <cube-name>.<fully-qualified-member-name> AS '<expression>' [,<property-definition-list>]
<property-definition-list> ::= <property-definition>
| <property-definition>, <property-definition-list>
<property-definition> ::= <property-identifier> = <property-value>
<property-identifier> ::= <identifier>
<property-value> ::= <string> | <number>
<optional-scope> ::= <empty> | SESSION
The <expression> value can contain functions that support multidimensional expressions (MDX) syntax.
The valid <property-identifier> values are listed under “Standard Properties” later in this topic.
Calculated members created with CREATE MEMBER without an <optional-scope> value have session scope.
CREATE MEMBER [WAREHOUSE].[MEASURES].[WAREHOUSEPROFIT]
AS '[MEASURES].[WAREHOUSE SALES] - [MEASURES].[WAREHOUSE COST]'
CREATE MEMBER [WAREHOUSE].[MEASURES].[WAREHOUSEPROFIT]
AS '[MEASURES].[WAREHOUSE SALES] - [MEASURES].[WAREHOUSE COST]',
SOLVEORDER=3
A calculated member can occur within one of three scopes:
A calculated member can be persisted in a local cube if a CREATE MEMBER statement is specified in the COMMAND clause of the CREATE CUBE statement.
CREATE CUBE MYWAREHOUSE
(
DIMENSION . . .
. . . ,
COMMAND [CREATE MEMBER [MYWAREHOUSE].[MEASURES].[WAREHOUSEPROFIT]
AS '[MEASURES].[WAREHOUSE SALES] - [MEASURES].[WAREHOUSE COST]']
)
Strings inside calculated member definitions are delimited with double quotation marks.
Each calculated member has a set of default properties. When a client is connected to Microsoft® SQL Server™ OLAP Services, the default properties are either supported or available to be supported, as the administrator chooses.
Additional member properties may be available, depending upon the cube definition. These properties represent information relevant to the dimension level in the cube.
Property Identifier | Meaning |
---|---|
SolveOrder | The order in which the calculated member will be solved in case of intersection with other calculated members. |
Format_String | Microsoft Office format string for displaying cell values. |