Generate

Return to: Calculated Member Builder Function List

Applies a set to each member of another set and joins the resulting sets by union.

Syntax

Generate(«Set1», «Set2»[, ALL])

Remarks

Applies «Set2» to each member of «Set1» and joins the resulting sets by union.

If ALL is specified, duplicates in the result are retained.

Example

Generate({USA, France}, Descendants(Geography.CurrentMember, Cities))

For each member of the set {USA, France}, this function applies the expression Descendants(Geography.CurrentMember, Cities). Each such application results in a set. (Application to USA will generate the set of all cities in USA; application to France will generate all cities in France.) These sets are joined by union to get the result of this function. In this example, all cities in USA and France will be the result. In general, Generate(«Set1», «set_expression») will apply «set_expression» to each member of «Set1» and join the results by union.

If «Set1» is not related to «set_expression» by means of CurrentMember, then Generate results in a simple replication of the set implied by «set_expression», with as many replications as there are tuples in «Set1». If the optional ALL flag is specified, all duplicates are retained in the result. If ALL is not specified, duplicates are removed. For example,

Generate({USA, FRANCE}, {SEATTLE, BOSTON}, ALL)

returns the set

{SEATTLE, BOSTON, SEATTLE, BOSTON}.

However, if ALL was not specified, then the set returned is

{SEATTLE, BOSTON}.

 

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.