Learning
Community
Open Exchange
Global Masters
InterSystems IRIS Data Platform 2019.3 / Application Development / InterSystems MDX Reference / MDX Functions / NONEMPTYCROSSJOIN
Previous section   Next section

NONEMPTYCROSSJOIN

Returns a set that consists of the cross-product of the given sets, excluding any tuples that are null.

Returned Type

This function returns a set of tuples.

Syntax and Details

NONEMPTYCROSSJOIN(set_expression1, set_expression2)
Where:
The function identifies all the members of each set and then generates a set of tuples that combine each member of the first set with each member of the second set. The returned set does not include empty tuples.
Note:
If you use this function in a query that refers to a compound cube, it returns the same results as CROSSJOIN. This is necessary to ensure that the subqueries have the same number of rows and can be combined. In this case, to exclude empty tuples, precede the function with the keyword phrase NON EMPTY.

Example

For example:
SELECT MEASURES.[%COUNT] ON 0, 
NONEMPTYCROSSJOIN(diagd.MEMBERS, aged.[age group].MEMBERS) ON 1 FROM patients
 
                             Patient Count
 1 None->0 to 29                        363
 2 None->30 to 59                       348
 3 None->60+                            120
 4 asthma->0 to 29                       36
 5 asthma->30 to 59                      37
 6 asthma->60+                           11
 7 CHD->30 to 59                         13
 8 CHD->60+                              23
 9 diabetes->0 to 29                      1
10 diabetes->30 to 59                    20
11 diabetes->60+                         25
12 osteoporosis->60+                     22
Previous section   Next section