Skip to main content

DRILLFACTS Statement (MDX)

Displays the lowest-level data associated with the first cell of results of a given SELECT statement, using the fact and dimension tables defined by the cube.

Syntax and Details

DRILLFACTS select_statement

Or:

DRILLFACTS select_statement RETURN fieldname1, fieldname2, ...

Or:

DRILLFACTS select_statement RETURN fieldname1, ... %ORDER BY fieldname3, ...

Where:

  • select_statement is a statement that uses SELECT.

  • fieldname1, fieldname2, fieldname3, fieldname4, and so on are names of fields in the fact table class defined by the cube.

If you do not specify the RETURN clause, the query returns the IDs of the records.

The %ORDER BY clause is an InterSystems extension to MDX. This clause specifies how to sort the displayed records.

For additional details on RETURN and %ORDER BY, see DRILLTHROUGH Statement.

Internally, the system builds and uses an SQL query.

Important:

If the SELECT statement returns more than one cell of data, the listing shows only the fields associated with the first cell.

Example

The first example does not use RETURN, so it uses the default listing as defined in the cube:

DRILLFACTS SELECT diagd.osteoporosis ON 0 FROM patients
 
   #  ID
   1: 7
   2: 13
   3: 42
   4: 123
   5: 140
...

The next example uses the RETURN clause:

drillfacts select diagd.osteoporosis on 0 from patients return dxcolor->dxcolor, dxage, dxpatgroup->dxpatgroup
 
   #  DxColor        DxAge          DxPatGroup
   1: Orange         7              Group A
   2: Red            11             Group B
   3: <null>         30             Group A
   4: Purple         58             Group A
   5: Purple         62             None
...

See Also

FeedbackOpens in a new tab