Creating Named Sets
It is often useful to create a set and assign a name to it, so that you can reuse that set in multiple ways. Also, the syntax of a query is often easier to read when you use named sets.
You can create one or more named sets within a query, as follows:
WITH with_clause1 with_clause2 ... SELECT query_details
Where:
-
Each expression with_clause1, with_clause2, and so on has the following syntax:
SET set_name AS 'set_expression'
-
query_details is your MDX query.
Then your query can refer the named set by name in all the places where you can use other set expressions.
For example:
WITH SET testset AS '{homed.city.members}'
SELECT MEASURES.[%COUNT] ON 0, testset ON 1 FROM demomdx
%COUNT
1 Cedar Falls 184
2 Centerville 194
3 Cypress 134
4 Elm Heights 146
5 Juniper 176
6 Magnolia 169
7 Pine 118
8 Redwood 182
9 Spruce 197