AnalysisServices.Database
The rows of a DAX query run on a semantic model: SQL Server or Azure Analysis Services, or a Power BI or Fabric semantic model.
Group: Databases and lakes. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
AnalysisServices.Database(server as text, database as text, optional options as nullable record) as table
| Parameter | Type | Description |
|---|---|---|
server | text | The server: a host, an asazure:// address, or a workspace's powerbi:// address. |
database | text | The model's name. |
options | nullable record optional | Query: the DAX query, EVALUATE ... (required). |
Returns
table. The query's result.
Remarks
- Sign in with Microsoft Entra ID (a work account) for the cloud, Windows for your own server, or a user and password (an HTTPS server, or a service principal).
- To use a model where it is, with its own measures, instead of copying rows into this one, connect live (Live connections in the docs).
- Credentials are never part of the M: the studio asks for a sign-in the first time this computer reads the source and keeps it on this computer only, for you.
Compared with Power Query
OpenBI reads a model through a DAX query only: without Query it stops and asks for one, where Power Query lists the cubes and tables to navigate.
Examples
Sales by year from a model
AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/Finance", "Sales", [Query = "
EVALUATE
SUMMARIZECOLUMNS ( 'Date'[Year], ""Sales"", [Sales] )
"])
Result: not shown here: it needs a semantic model and a sign-in.
Without a query
AnalysisServices.Database("localhost", "Sales")
Result: an error.
[Reason = "Expression.Error", Message = "AnalysisServices.Database: give the query, [Query = ""EVALUATE ...""].", Detail = null]