Analysis Services MDX Query Designer (SSAS)

 

Applies To: SQL Server 2016

The Analysis Services Multidimensional Expression (MDX) query designer provides a graphical user interfaces to help you create MDX queries for a Microsoft SQL Server Analysis Services data source. The MDX graphical query designer has two modes: design mode and query mode. Each mode provides a metadata pane from which you can drag members from the selected cubes to build an MDX query that retrieves the data you want to use.

System_CAPS_ICON_important.jpg Important


Users access data sources when they create and run queries. You should grant minimal permissions on the data sources, such as read-only permissions.

The credentials of the current user, not the credentials specified in the Impersonation Information page, are used to connect to the data source when a query is executed.

The following sections describe the toolbar buttons and query designer panes for each mode of the graphical query designer.

When you edit an MDX query, the graphical MDX query designer opens in Design mode.

The following figure labels the panes for Design mode.

Analysis Services MDX query designer, design view

The following table lists the panes in this mode:

PaneFunction
Select Cube button (...)Displays the currently selected cube.
Metadata paneDisplays a hierarchical list of measures, Key Performance Indicators (KPIs), and dimensions defined on the selected cube.
Calculated Members paneDisplays the currently defined calculated members available for use in the query.
Filter paneUse to choose dimensions and related hierarchies to filter data at the source and limit data returned.
Data paneDisplays the column headings for the result set as you drag items from the Metadata pane and the Calculated Members pane. Automatically updates the result set if the AutoExecute button is selected.

You can drag dimensions, measures, and KPIs from the Metadata pane, and calculated members from the Calculated Member pane, onto the Data pane. In the Filter pane, you can select dimensions and related hierarchies, and set filter expressions to limit the data available to query. If the AutoExecute (AutoExecute the query) toggle button on the toolbar is selected, the query designer runs the query every time that you drop a metadata object onto the Data pane. You can manually run the query using the Run (Run the query) button on the toolbar.

When you create an MDX query in this mode, the following additional properties are automatically included in the query:

Member Properties MEMBER_CAPTION, MEMBER_UNIQUE_NAME

Cell Properties VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

To specify your own additional properties, you must manually edit the MDX query in Query mode.

Importing an .mdx query from a file is not supported.

System_CAPS_ICON_note.jpg Note


For more information about MDX and general information about the MDX query designer, see "MDX Query Editor (Analysis Services - Multidimensional Data)" in SQL Server Books Online.

Graphical MDX Query Designer Toolbar in Design Mode

The query designer toolbar provides buttons to help you design MDX queries using the graphical interface. The following table lists the buttons and their functions.

ButtonDescription
Edit As TextNot enabled for this data source type.
ImportImport an existing query from a report definition (.rdl) file on the file system.
Change to MDX query viewSwitch to Command Type MDX.
Refresh result dataRefresh metadata from the data source.
Add calculated memberDisplay the Calculated Member Builder dialog box.
Toggle for show empty cellsToggle between showing and not showing empty cells in the Data pane. (This is the equivalent to using the NON EMPTY clause in MDX).
AutoExecute the queryAutomatically run the query and show the result every time a change is made. Results are shown in the Data pane.
Show Aggregations buttonShow aggregations in the Data pane.
DeleteDelete the selected column in the Data pane from the query.
Icon for the Query Parameters dialog boxDisplay the Query Parameters dialog box. When you specify values for a query parameter, a parameter with the same name is automatically created.
Prepare Query buttonPrepare the query.
Run the queryRun the query and display the results in the Data pane.
Cancel the queryCancel the query.
Switch to Design modeToggle between Design mode and Query mode.

To change the graphical query designer to Query mode, click the Design Mode button on the toolbar.

The following figure labels the panes for Query mode.

Analysis Services MDX query designer, query view

The following table lists the panes in this mode:

PaneFunction
Select Cube button (...)Displays the currently selected cube.
Metadata/Functions/Templates paneDisplays a hierarchical list of measures, KPIs, and dimensions defined on the selected cube.
Query paneDisplays the query text.
Result paneDisplays the results of running the query.

The Metadata pane displays tabs for Metadata, Functions, and Templates. From the Metadata tab, you can drag dimensions, hierarchies, KPIs, and measures onto the MDX Query pane. From the Functions tab, you can drag functions onto the MDX Query pane. From the Templates tab, you can add MDX templates to the MDX Query pane. When you execute the query, the Result pane displays the results for the MDX query.

You can extend the default MDX query generated in Design mode to include additional member properties and cell properties. When you run the query, these values do not appear in the result set. However, they are passed back with the dataset field collection and you can use these values.

Graphical Query Designer Toolbar in Query Mode

The query designer toolbar provides buttons to help you design MDX queries using the graphical interface.

The toolbar buttons are identical between Design mode and Query mode, but the following buttons are not enabled for Query mode:

  • Edit As Text

  • Add Calculated Member (Add calculated member)

  • Show Empty Cells (Toggle for show empty cells)

  • AutoExecute (AutoExecute the query)

  • Show Aggregations (Show Aggregations button)

Community Additions

ADD
Show: