# Analytics Queries

In Open Data Blend Analytics, any query that is submitted as DAX or MDX is considered an Analytics Query.

## DAX Queries

[Data Analysis Expression (DAX)](https://docs.microsoft.com/en-us/dax/dax-overview) queries look like the following example.

```
DEFINE
    VAR __DS0Core =
        SUMMARIZECOLUMNS (
            'Anonymised MOT Test Result Info'[Test Postcode Area Name],
            "Anonymised_MOT_Test_Results", 'Calculation'[Anonymised MOT Test Results]
        )
    VAR __DS0PrimaryWindowed =
        TOPN (
            1001,
            __DS0Core,
            [Anonymised_MOT_Test_Results], 0,
            'Anonymised MOT Test Result Info'[Test Postcode Area Name], 1
        )
EVALUATE
__DS0PrimaryWindowed
ORDER BY
    [Anonymised_MOT_Test_Results] DESC,
    'Anonymised MOT Test Result Info'[Test Postcode Area Name]

```

Examples of client tools that can generate these queries are Power BI Desktop and Power BI Report Builder.

## MDX Queries

[Multidimensional Expression (MDX)](https://docs.microsoft.com/en-us/analysis-services/multidimensional-models/mdx/mdx-query-fundamentals-analysis-services?view=asallproducts-allversions) queries look like the following example.

```
SELECT {
         [Measures].[English Prescription Actual Cost],  
         [Measures].[English Prescription Items Total Quantity],  
         [Measures].[English Prescription Items],  
         [Measures].[English Prescription Quantity],  
         [Measures].[English Prescriptions]
       }, 
       NON EMPTY [Prescribing Practice].[Prescribing Practice Code (Source)].[Prescribing Practice Code (Source)].AllMembers ON ROWS 
FROM [Model]
```

Examples of client tools that can generate these queries are Excel and Tableau Desktop.

## Generated Queries

Client tools such as Excel, Power BI Desktop, and Tableau Desktop will typically generate one query per visualisation (e.g. charts, graphics, tables, etc). Placing too many visuals on a dashboard or report page can cause each refresh of a page display to send several queries to the Open Data Blend Analytics service. This should be considered when making dashboards and report design decisions, as it can reduce their responsiveness.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opendatablend.io/open-data-blend-analytics/analytics-queries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
