Skip to main content

DAX Query Tasks

Administrator

DataCentral empowers advanced users and developers to extract raw data from Power BI datasets dynamically using DAX Query Tasks. This feature allows you to execute custom Data Analysis Expressions (DAX) against your embedded datasets and retrieve the results directly.


1. What is a DAX Query Task?

A DAX Query Task is a configured endpoint within DataCentral that executes a predefined DAX query against a specific Power BI dataset.

Unlike Action Tasks (which send data out to external webhooks), DAX Query Tasks pull data in from Power BI.

Common Use Cases

  • Custom Data Extracts: An analyst needs a highly specific cut of data that isn't available in any existing report visual. They can trigger a DAX Query Task to download the exact dataset they need as a CSV or JSON file.
  • Integration with Third-Party Tools: A developer building a custom application needs to pull live metrics from a Power BI dataset. They can call the DataCentral API, which triggers a DAX Query Task and returns the results for use in their application.
  • Automated Reporting: A scheduled job triggers a DAX Query Task every morning to extract the previous day's sales figures and emails them to the executive team.

2. Configuring a DAX Query Task

To create a DAX Query Task, you must have Tenant Administrator privileges and a solid understanding of DAX syntax.

  1. Navigate to Administration > Tasks.
  2. Click Create Task and select DAX Query Task.
  3. Provide a Name (e.g., "Extract Top 10 Customers by Revenue") and a brief Description.
  4. Select the target Power BI Dataset from the dropdown menu. This is the dataset your query will run against.
  5. In the DAX Query editor, enter your custom DAX code. Ensure the query returns a valid table structure (e.g., using EVALUATE).

Example DAX Query:

EVALUATE
TOPN (
10,
SUMMARIZECOLUMNS (
'Customer'[CustomerName],
"Total Revenue", [Total Revenue]
),
[Total Revenue], DESC
)

3. Executing DAX Query Tasks

Once a DAX Query Task is configured, it can be executed in two ways:

Via the DataCentral UI

Administrators or authorized users can trigger the task directly from the DataCentral interface. The results will be displayed in a data grid, and the user can download them as a CSV or Excel file.

Via the DataCentral API

Developers can execute DAX Query Tasks programmatically using the DataCentral REST API.

  1. Authenticate with the DataCentral API using an API token.
  2. Send a POST request to the /api/v1/tasks/{taskId}/execute endpoint.
  3. The API will return the results of the DAX query in JSON format.

4. Security and Performance

DAX Query Tasks require careful management to ensure security and maintain dataset performance.

  • Role-Based Access: You can restrict which roles are allowed to execute specific DAX Query Tasks. Only grant access to users who absolutely need to extract raw data.
  • Row-Level Security (RLS): When a DAX Query Task is executed, DataCentral automatically applies the RLS rules associated with the user triggering the task. A user can never extract data they are not authorized to see, even if the DAX query attempts to select the entire table.
  • Query Timeouts: To prevent poorly written DAX queries from locking up your Power BI datasets, DataCentral enforces strict execution timeouts. If a query takes too long to run, it will be automatically terminated.