Download Reportworq
⬇ Guide PDF

Connect Power BI and Analysis Services#

Reportworq connects to Power BI semantic models (datasets) and to Azure or SQL Server Analysis Services tabular models over the XMLA endpoint, using the native ADOMD client. In the connector catalog this tile is PowerBI XMLA - ADOMD, and once created the connection's type reads Power BI / SSAS (ADOMD).

There are two different ways to reach a Power BI XMLA endpoint, and they are separate connectors:

Tile Driver Query languages
PowerBI XMLA - ADOMD Native ADOMD client DAX, DMV, and MDX
PowerBI XMLA - SQL CData driver SQL only

This page covers the ADOMD connection. For the CData one, see the Connector catalog. Both return their results through the same worksheet formula, RW.Relational.Export.

Before you begin#

Add the connection#

  1. Go to Settings > Integrations, then select Add integration.
  2. Find PowerBI XMLA - ADOMD in the catalog and select Add. The connection editor opens.
  3. Select Enable datasource connection.
  4. Give the connection a Datasource Name. This is the name your RW.Relational.Export formulas refer to, so it must be unique across the instance and is awkward to change later.
  5. Choose an Authentication Mode and complete its fields, as described below.
  6. Enter the Connection String, as described in Connection strings.
  7. Select Test connection, then Save.

Datasource settings#

Setting What it does
Enable datasource connection The gate that makes the connection usable. A disabled datasource cannot be selected or refreshed.
Datasource Name The friendly name referenced from RW.Relational.Export.
Authentication Mode Password Authentication, OAuth (Service Principal), or OAuth (Interactive Login).
Connection String The XMLA endpoint, and optionally the model. Supports the %USERNAME% and %PASSWORD% placeholders.
%USERNAME% Variable The value substituted for %USERNAME%. Masked, and stored encrypted.
%PASSWORD% Variable The value substituted for %PASSWORD%. Masked, and stored encrypted.
Validation Query The query Test connection runs. Defaults to SELECT * FROM $SYSTEM.DISCOVER_CATALOGS, a lightweight DMV that works against both Power BI XMLA and Analysis Services.
Command Timeout Under Advanced Options, which is collapsed by default. Query timeout in seconds, default 30, range 1 to 3600.

Connection strings#

The connection string identifies the XMLA endpoint (the Data Source) and, optionally, the model (Initial Catalog).

Power BI

Data Source=powerbi://api.powerbi.com/v1.0/myorg/MyWorkspace;Initial Catalog=MyDataset

MyWorkspace is the Power BI workspace name, and Initial Catalog is the dataset or semantic model name.

Azure Analysis Services

Data Source=asazure://<region>.asazure.windows.net/<servername>;Initial Catalog=<modelname>

On-premises SQL Server Analysis Services (tabular)

Data Source=<server>\<instance>;Initial Catalog=<database>

Keep credentials out of the connection string#

Anywhere in the connection string you can write the tokens %USERNAME% and %PASSWORD%. When the connection opens, Reportworq replaces them with the values from the %USERNAME% Variable and %PASSWORD% Variable fields, both of which are masked in the editor and stored encrypted. This keeps the real credentials out of the visible connection string. The editor's field labels are clickable and copy the token to your clipboard.

Choose an authentication mode#

OAuth (Service Principal)#

Use this for unattended, server-to-server access. It is the right default for scheduled reporting. Reportworq acquires an Entra (Azure AD) access token using the OAuth 2.0 client credentials grant and presents it to the XMLA endpoint. No user is involved, no credentials appear in the connection string, and the token is refreshed automatically before it expires.

Select OAuth (Service Principal) and provide:

Setting Value
Tenant ID The Entra (Azure AD) tenant, or directory, ID.
Client ID (Application ID) The app registration's Application (client) ID.
Client Secret The app registration's client secret. Masked, and stored encrypted.
OAuth Scope (optional) Leave blank to use the default Analysis Services scope, https://analysis.windows.net/powerbi/api/.default. Override only if your environment requires a different scope.

With this mode the Connection String contains only the endpoint, with no user or password:

Data Source=powerbi://api.powerbi.com/v1.0/myorg/MyWorkspace;Initial Catalog=MyDataset

Two things must be true before it will work:

OAuth (Interactive Login)#

Use this when the model should be read as a named person and that person can sign in once. Reportworq uses the OAuth authorization-code grant: you sign in through the browser, and the resulting access and refresh tokens are stored on the connection and refreshed automatically at run time.

Select OAuth (Interactive Login) and provide the same Tenant ID, Client ID, Client Secret, and optional OAuth Scope as the service-principal mode. Two extra fields appear:

To sign in:

  1. Save your changes first. Selecting Authenticate... with unsaved edits returns "Please save changes before performing this operation." The same applies to Sign out....
  2. Select Authenticate.... Sign-in opens in a new browser tab, and the status updates to Signed in when it completes.

The browser address must be HTTPS, or localhost. Interactive sign-in cannot complete over plain http:// on a non-localhost address, and Reportworq stops with a message saying so.

Password Authentication#

Use this to connect as a specific organizational user without an app registration. The credentials travel in the connection string, so use the %USERNAME% and %PASSWORD% placeholders and keep the real values in the encrypted variable fields.

Select Password Authentication and set the Connection String with the placeholders:

Data Source=powerbi://api.powerbi.com/v1.0/myorg/MyWorkspace;Initial Catalog=MyDataset;User ID=%USERNAME%;Password=%PASSWORD%

Then fill in %USERNAME% Variable (for example analyst@contoso.com) and %PASSWORD% Variable.

Accounts that require interactive multi-factor authentication cannot use this mode. Report generation runs unattended on the server, so "user login" here means organizational account credentials supplied through the encrypted variables, not a browser prompt. If the account is subject to MFA, use OAuth (Service Principal) for unattended access, or OAuth (Interactive Login) if a person can sign in once.

Query the model#

Reference the connection by its Datasource Name from the RW.Relational.Export worksheet formula. The formula runs the query text you give it and imports the result into an Excel range or table. The ADOMD connection accepts DAX, DMV, and MDX.

DAX

=RW.Relational.Export(A1, "PowerBI ADOMD", "EVALUATE SUMMARIZECOLUMNS('Date'[Year], ""Revenue"", [Total Revenue])")

DMV, for metadata discovery

=RW.Relational.Export(A1, "PowerBI ADOMD", "SELECT * FROM $SYSTEM.DISCOVER_CATALOGS")

MDX

=RW.Relational.Export(A1, "PowerBI ADOMD", "SELECT NON EMPTY [Date].[Year].Children ON ROWS, {[Measures].[Total Revenue]} ON COLUMNS FROM [Model]")

An MDX query must return a flat, tabular result. If the result cannot be flattened into rows and columns, the formula reports an error. Rewrite the query so its result is tabular, or express it as DAX. For genuine matrix output, use the MDX query type's crosstab render mode in a data model rather than RW.Relational.Export.

Behavior and limits#

Troubleshooting#

Symptom Likely cause What to do
Test connection fails with an authorization error Bad credentials, or the principal has no workspace access For OAuth, verify the Tenant ID, Client ID, and secret, and that the service principal is a member of the workspace. For password mode, verify the account and password.
OAuth fails saying service principals are not allowed The tenant admin setting is disabled Enable Allow service principals to use Power BI APIs, and set the XMLA endpoint to Read or Read Write in the Power BI admin portal.
Cannot connect to a Power BI dataset at all The workspace is not on Premium, PPU, or Fabric capacity The XMLA endpoint requires one of those capacities. Shared and Pro workspaces have no XMLA endpoint.
A Connection String is required The Connection String field is blank Provide the Data Source=... endpoint string.
Tenant ID / Client ID / Client Secret is required An OAuth mode is selected but a field is blank Fill in all three, or switch to Password Authentication.
Please save changes before performing this operation You selected Authenticate... or Sign out... with unsaved edits Save the connection, then try again.
Interactive sign-in will not start The browser address is plain http:// on a non-localhost host Reach Reportworq over HTTPS, or use localhost, then sign in again.
Password mode fails with an MFA or interactive sign-in error The account requires interactive MFA Use OAuth (Service Principal), or an account exempt from interactive MFA.
An MDX query returns an error instead of data The MDX result is not tabular Rewrite the MDX to return a flat result, or express the query as DAX.

Feedback on this page

Comments, questions, requests, or something missing or unclear? Email us - the page you are on is filled in for you.

Email feedback on this page

Or write to support@reportworq.com directly.