Query Data in Azure Analysis Services

Azure Analysis Services enables you to query your tabular data models using various tools and languages. The primary query languages used are DAX (Data Analysis Expressions) and MDX (Multidimensional Expressions).

Using DAX

DAX is a powerful formula expression language used in Power BI, Analysis Services, and SQL Server Analysis Services. It's ideal for querying and analyzing tabular models.

You can use DAX queries with tools like:

Example DAX Query

This query returns the total sales amount for each product category.

EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Category],
    "Total Sales", SUM ( 'Sales'[SalesAmount] )
)
ORDER BY [Category]

Using MDX

MDX is a query language for OLAP (Online Analytical Processing) cubes. While Azure Analysis Services primarily uses tabular models, it still supports MDX for backward compatibility and certain analytical scenarios.

MDX queries are often used with tools like:

Example MDX Query

This MDX query retrieves sales amounts by country.

SELECT
    [Measures].[Sales Amount] ON COLUMNS,
    [Geography].[Country].MEMBERS ON ROWS
FROM [AdventureWorks]

Connecting to Your Model

To query your Azure Analysis Services model, you'll need to establish a connection from your chosen client tool. This typically involves providing the server name (your Analysis Services instance name) and specifying the database (your model name).

Tip: For optimal performance with tabular models, DAX is generally the preferred query language.

Tools for Querying

Explore the documentation for specific client tools to learn how to construct and execute your DAX and MDX queries effectively.