This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
We are very excited to announce the public preview of a new REST API to query datasets in Power BI by using Data Analysis Expressions (DAX). Among other things, this new DAX REST API helps to address customer feedback concerning programmatic access to the data in a dataset (for example, the idea REST API access to READ datasets with almost 500 votes by the time of this announcement). The new DAX REST API avoids dependencies on Analysis Services client libraries, requires no connection to XMLA endpoints, and works in Power BI Premium as well as in Power BI shared capacity. In short, there are many good reasons for BI solution developers to evaluate this REST API during the public preview period.
One of the greatest advantages of a REST API to query datasets is that you can use this REST API in practically any modern development environment on any platform, including low-code no-code Power Apps, Power Automate, and Logic Apps, JavaScript-based languages, PowerShell, Java, PHP, Ruby, Python, or any other technology that can authenticate with Azure Active Directory (AAD) and construct a Web request. Of course, you can also use .NET to call this REST API. As other Power BI REST APIs, the DAX REST API supports user accounts, service principals, and works in B2B scenarios, and because the caller is fully identifiable, row-level security (RLS) and other controls at the dataset level are applied as expected -- with the caveat that RLS is not supported for service principals. See the Limitations section in the Row-level security (RLS) with Power BI product documentation.
Yet, before you take this new REST API for a test spin, note that the tenant-level setting Allow XMLA endpoints and Analyze in Excel with on-premises datasets must be enabled in the Power BI admin portal, as depicted in the screenshot below. This setting is enabled by default, but double-check with your Power BI admin. At least for the duration of the public preview period, it seemed appropriate to govern this new DAX REST API with the existing XMLA endpoints tenant setting, The DAX query functionality is comparable to XMLA read access. We are still evaluating if this DAX REST API should have its own tenant setting. Please give us feedback if you want to influence this decision.
Announcing_the_public_preview_of_Power_BI_REST_API_support_for_DAX_Queries
Equally important and also consistent with XMLA read access, you need the Build permission for the dataset you want to query by using this new REST API. Contributors and workspace admins have this permission, but you can also grant it directly, as in the following screenshot. For more information, see Build permission for shared datasets. Also note that the workspace must be a modern (v2) workspace. Classic (legacy) workspaces are not supported. So, if your datasets still reside in a classic workspace, make sure you upgrade the workspace to the new (v2) workspace experience.
Announcing_the_public_preview_of_Power_BI_REST_API_support_for_DAX_Queries
Perhaps the easiest way to test the DAX REST API is to query a dataset by using the Power BI Management cmdlets. See the following screenshot for a straightforward sample script based on an AdventureWorks dataset.
Announcing_the_public_preview_of_Power_BI_REST_API_support_for_DAX_Queries
Essentially, the above script performs the following main steps:
Announcing_the_public_preview_of_Power_BI_REST_API_support_for_DAX_Queries
As mentioned already, remember that the request body currently can only contain 1 DAX query and accordingly there is only 1 result set. Future versions of the API might support more. Also note that the result set is currently capped at 100k rows. If you need to retrieve more rows, you must construct and submit multiple DAX queries that each only retrieves an appropriate portion of the results. Moreover, the result set does not support binary data. Make sure your values are of the type string, numeric, boolean, blank, date time or variant. Needless to say that this is a Power BI API and therefore not available in Azure Analysis Services (Azure AS) or SQL Server Analysis Services (SSAS). And because this is a DAX REST API, you cannot submit MDX or DMV queries.
Current limitations in a nutshell:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.