Migrating Dataflow

df0

I was recently involved in a project to migrate multiple dataflows across workspaces. While exporting the dataflow by creating a .json file is known, I didn't find any references on how to fix the Power BI Desktop report to point to the migrated dataflows. In this post I will describe how to do that easily. If you prefer, you can watch the video at the end of the blog post.

Steps:

  • First and foremost you will need to setup the enterprise data gateway, add the required data sources and authenticate them. Before following any of the steps below, ensure that the gateway is setup correctly and its running.

  • In Power BI service, browse to the dataflow you want to export

  • Click on the ellipses (three dots) and select Export .json. The json file contains the data and the metadata associated with the dataflow for all the queries within it.

df1

  • In Power BI service, browse to the second workspace to which you want to migrate the saved dataflow and select Import Model. Import the saved the json file.

df2

  • You will be prompted to Edit Credentials. If your data source needs credentials, enter the credentials under Data source credentails in Settings

  • Refresh the newly imported dataflow to make sure you are able to pull the data and run the queries

  • Select the imported dataflow and copy the URL in the browser. The URL will be in following format:

    https://app.powerbi.com/groups/{workspace_id}/dataflows/{dataflow_id}

  • Copy the workspace id & the dataflow id, we need those to reconfigure the queries in Desktop. If you have multiple dataflows, you may find it easier to use the API

  • Open the report in Power BI desktop, create two parameters for workspace_id and the dataflow_id. Use the above copied strings as the default values. You can watch the below video if you don't know how to create the parameters

  • Open the M code for each query in the dataflow and replace the workspaceId="{original_workspaceid}" with the workspaceId=workspace_id_parameter

df3

  • Repeat the same thing for the dataflow id, replace dataflowId="{original_dataflowid}" with dataflowId=dataflow_id

  • Repeat this for each dataflow query. Since you created the parameters, you only need to replace the id strings with the respective parameters

  • Refresh all queries to ensure they are working

  • Delete the original dataflow from the first workspace as we don't need it anymore

Video