Change your Power BI report to point to an external SSAS model

A common questions I get is to change the connection string to from my report to SSAS after I move my Power BI desktop file into SSAS. It turns out this actually pretty simple as there is an API that allows you to copy and then bind the report to ANY dataset. Let’s walk through this.

I start with a very simple Power BI desktop file that contains a single table that I imported from SQL:


I then upload it to Power BI, I added it to it’s own app workspace.

Then I created a report that points to my local SSAS and uploaded it to the same workspace, I do this to make sure I have a dataset in Power BI that points to SSAS. If you already have a dataset present you can skip this step. Of course you have to set up a data gateway in case of using a local SSAS.

So now I have 2 datasets in my workspace (I use the same workspace but you can also have them live in different ones):


SalesIt is the dataset that points to my SSAS instance and the SalesPBI is the embedded data model. I also have the 2 reports:


Now here comes the magic. I am using a PowerShell script created by my colleague Sirui that allows you to copy and bind the new report to ANY dataset in Power BI. You can find the script here. The key thing here is to make sure the 2 schema’s are the same, it needs to have the same columns, measures, tables etc otherwise the report will throw errors. In my example I didn’t actually use a imported model but used a SQL Server 2016 RTM model with the same schema and that also works.

Ok now for the PowerShell script, it does two things:

1 It creates a copy of the report

2 It binds the new report to a dataset provided in the script

The script uses to the Power BI Clone API to clone the report and rebind it..

First we need to configure the the script, I created a new “app” on as described in the script to get a new client Id and set a name for my new report called “SalesNowIt”. Next I got all the ID’s needed for the script to run like report and groupId’s. The script has step by step instructions.

Now after configuring I just run the PowerShell script (no additional changes necessary). And now see a new report showing up:


And now when I run the report that previously pointed to my embedded model it still works:


But when running profiler I see queries going to my local SSAS instead of the embedded model:


So that’s it, pretty straightforward and very straightforward.  Of course you can extend this PowerShell script yourself to do whatever you want, for example, loop through all the reports in a workspace and rebind them all.

14 Replies to “Change your Power BI report to point to an external SSAS model

  1. Hello Kasper,

    Thank you for the detailed write up. The solution is not working for me as I’m unable to create a clientid when going to the site.

    We’re attempting to find a way to change our existing Azure BLOB csv data source to Azure Analysis Services

    Any help would be much appreciated.

        1. I was able to obtain the clientID via the Azure Portal (Thank you). But when I run the script, I’m now receiving the following error message “Invoke-RestMethod : The remote server returned an error: (401) Unauthorized. + Invoke-RestMethod -Uri $uri –Headers $authHeader –Method POST -Body $ …” I checked the permissions and they seem to be ok.

          1. I am the owner of the data sets now (by taking over). But still getting the same error.
            Any other pointers?

  2. Hi Kasper,
    I am even the owner of the data set and I have taken over the one where I was not. But I am still getting the same error when I am using Client Id.
    Meanwhile I have gone in Azure portal and tried to give access and grant permissions from there as well but no luck. Could you please suggest.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.