Defining named sets

A named set allows you to create an expression that defines a set of members. When you run a report containing a named set, the corresponding expression is evaluated and the resulting set of members is rendered in the report.

A named set is defined by a dimensional set expression that evaluates to a set of members from a single hierarchy. For example, topcount(Customers, 5, Sales).

After you publish dynamic cubes, the named sets are available as data items in the Named Sets folder within the metadata tree in IBM® Cognos® studios.

Tip: Named sets can also be defined at the query level. However, the named sets that are defined for dynamic cubes can be authored once and reused multiple times in different reports.

IBM Cognos Cube Designer validates the syntax of named set expressions. After a cube is started, the dynamic cube server validates the semantics of the expressions by using the cube default member context and the security of the access account. Any expression that is not successfully validated while the cube is starting is removed from the cube and is not available in the studios. If an expression is removed, an error message is recorded in a cognos_analytics_location/logs/XQE log file.

A named set is dynamic. It is evaluated at report execution time using the query context and the security of the currently authenticated user. For example, a named set nested under a set of years is evaluated independently for each year.

You can use named sets within other named set expressions or within a calculated member or measure expression. Named sets can include parameters and macros.

If you are using member or attribute security, the security is also applied to the named set members.

Named sets from source cubes are not inherited in a virtual cube. If you want to use the named sets in a virtual cube, you must define them for the virtual cube.

You create named sets at the cube level, for dynamic cubes and virtual cubes. Named sets are stored within the Named Sets folder. You can organize named sets by creating sub-folders within the Named Sets folder.

Procedure

Use the following steps to create a new folder in the Named Sets folder and to define a named set expression.

  1. Create a new folder in the Named Sets folder using the following steps:
    1. From the Project Explorer tree, expand your cube.
    2. Right-click the Named Sets folder, and then click New > Named Set Folder.
    3. The new named set is created with a working name New Named Set Folder. Rename the folder as required.
  2. Right-click the named set folder where you want to store the named set expression, and click New > Named Set.
    Tip: You can create the named set expression in the folder that you created in step 1, or in a different folder in the Named Sets folder.
  3. The new named set is created with a working name New Named Set. Rename the named set as required.
  4. Double-click the name set to open the expression editor.
  5. Define the named set expression using members and a valid set of multidimensional operators and functions.
  6. Right-click the name set in Project Explorer, and click Validate to validate the expression syntax.

    The validation errors are displayed on the Issues tab.

    Tip: If a named set contains circular references (a reference to itself), a validation error occurs at cube start time and the named set is removed from the cube.