Generate

Applies a set to each member of another set, and then joins the resulting sets by union. Alternatively, this function returns a concatenated string created by evaluating a string expression over a set.

Syntax

Set expression syntax
	Generate( Set_Expression1 ,  Set_Expression2 , ALL )

String expression syntax
	Generate( Set_Expression1 ,  String_Expression , Delimiter )

Arguments

Set_Expression1
MDX expression that returns a set.
Set_Expression2
MDX expression that returns a set.
String_Expression
String expression
Delimiter
A valid delimiter expressed as a string expression.

Examples

Following example returns the names of all issues for each issue type. 

Generate(
  Filter(NonEmptyCrossJoin([Issue].[Issue].Members, [Measures].DefaultMember),
    [Measures].[Issue type] = [Issue Type].CurrentMember.Name),
  [Issue].CurrentMember.Name, ', '
)


To display another member property, use getString() function to ensure that string expression is returned. The ollowing example returns the category (custom property) of all issues for each issue type. 

Generate(
  Filter(NonEmptyCrossJoin([Issue].[Issue].Members, [Measures].DefaultMember),
    [Measures].[Issue type] = [Issue Type].CurrentMember.Name),
  [Issue].CurrentMember.getString('Category'), ', '
)

See also