TARGET these files: Connections , DataMashup (I used Total Commander for this as it was simplest and it supports archive files)3. Rename TARGET file back to .pbix4. Open TARGET file in Power BI5. The design/visuals and the Old table structure should be visible under "Fields"6. A yellow warning reading "There are pending changes in your queries that haven't been applied [Apply changes]" should also be displayed7. Click [Apply changes]8. All designs/visuals should get an (X) and the message "Something's wrong..."9. Now go to "Get Data" and select your datasource (i wanted to use data from Power BI services, and a previously published reports dataset. Select your datasource and Load it.10. The designs/visuals should get the proper data filled inn (connection in model checks out) assuming that the previously published report/dataset holds the same table (same name etc).11. PROSPER!! If you in your TARGET file which is relying on datasource import has created measures and such, these should probably be re-created in the published report/dataset prior to following the steps above (untested). Note: If you are unable to open the .pbix file in PowerBI after renaming it back to .zip, there might be an issue with your zip program. For my part it failed when using windows inbuildt functionality but worked when using Total Commander to copy files between the .zip files... Hope this is of value and help." />
Skip to main content

Power BI

Needs Votes

Way to change datasource import to direct/live query

Vote (171) Share
's profile image

on 07 Sep 2017 17:36:25

Create a way to automate the following manual steps..

Hi all

I recently wanted to change the datasource from Import to Live Query using the "Power BI service" and had a good lookaround without turning up much other than "you can not"...

However I managed to get it going, effectively maintaining my designs/visuals and changing datasource so that I can get away with publishing one report whenever my data changes.

Prerequisites:
* TARGET: A .pbix file with designs/visuals using import, no measures.
* SOURCE: A clean .pbix file using Live Query to a report/dataset published to app.powerbi.com (no designs/visuals)
-This .pbix file must have the same table as the TARGET file (ie: using the same db)

Steps:
1. Rename .pbix files to .zip
2. Copy from SOURCE => TARGET these files: Connections , DataMashup
(I used Total Commander for this as it was simplest and it supports archive files)
3. Rename TARGET file back to .pbix
4. Open TARGET file in Power BI
5. The design/visuals and the Old table structure should be visible under "Fields"
6. A yellow warning reading "There are pending changes in your queries that haven't been applied [Apply changes]"
should also be displayed
7. Click [Apply changes]
8. All designs/visuals should get an (X) and the message "Something's wrong..."
9. Now go to "Get Data" and select your datasource (i wanted to use data from Power BI services, and a previously published
reports dataset. Select your datasource and Load it.
10. The designs/visuals should get the proper data filled inn (connection in model checks out) assuming that the previously
published report/dataset holds the same table (same name etc).
11. PROSPER!!

If you in your TARGET file which is relying on datasource import has created measures and such, these should probably be re-created in the published report/dataset prior to following the steps above (untested).

Note: If you are unable to open the .pbix file in PowerBI after renaming it back to .zip, there might be an issue with your zip program. For my part it failed when using windows inbuildt functionality but worked when using Total Commander to copy files between the .zip files...

Hope this is of value and help.

Comments (9)
's profile image Profile Picture

7f0f1d17 8f87-4573-9f95-04052656ad77 on 16 Aug 2020 04:13:35

RE: Way to change datasource import to direct/live query

Thanks I think it works! But my interaction and data table relationships all disappeared ... Wondering if it is normal or not?

's profile image Profile Picture

18d24bd5 3c35-4ab8-9359-7fb47e164c6b on 16 Aug 2020 04:11:45

RE: Way to change datasource import to direct/live query

Even though I don't have "Connections" file, I have deleted "Datamodel" in the TARGET and copied "Datamashup" from SOURCE and it worked perfectly. Thanks a lot!!!

's profile image Profile Picture

7dc3209f 9677-4ee7-a1b8-0065a7966203 on 16 Aug 2020 04:06:39

RE: Way to change datasource import to direct/live query

I could not get this to work. There were no "Connections" files in the zip files. I copied over the DataMashup but when I opened the SOURCE .pbix, all the visualizations were broken, and remained broken no matter what I did with Get Data or queries, etc.

's profile image Profile Picture

66eadf11 0554-43f2-a5af-14f479ead6aa on 16 Aug 2020 04:04:08

RE: Way to change datasource import to direct/live query

This WORKS! Thank you SO Much for sharing!!!

's profile image Profile Picture

792f2999 397b-4619-8b5c-48cecbc2c5d2 on 16 Aug 2020 04:04:03

RE: Way to change datasource import to direct/live query

A more general idea to be able to swap all datasources from Import to Direct Query (or presumably vice versa) would be better.

's profile image Profile Picture

03dcb639 7e6e-4a38-9837-6ad5ea66c643 on 16 Aug 2020 04:02:19

RE: Way to change datasource import to direct/live query

I do not have the Connections file.
Do I have to erase all measures and calculate tables from source in order for this procedure to work?

Once I rename target from .zip to .pbix again it loads everything as in Import Mode again :(

's profile image Profile Picture

baa8e2dc 8289-4262-a8d7-d6a5e4b3fb29 on 16 Aug 2020 04:01:08

RE: Way to change datasource import to direct/live query

When I tried extract the zip it doesn't have TARGET folder.. Can you help?

's profile image Profile Picture

f2cba126 9651-42cb-8ae3-376a9e5a20a5 on 16 Aug 2020 03:58:36

RE: Way to change datasource import to direct/live query

Change to step 2.

2. Do this [edited steps]:
=> DELETE "Datamodel" from TARGET
=> COPY "Datamashup" from SOURCE to TARGET, overwrite.
[ =>Not necessary to copy "Connections" based on latest test, but it does not seem to hurt]
(I used Total Commander for this as it was simplest and it supports archive files)

's profile image Profile Picture

9d1909b8 9acf-ea11-a812-000d3a8ddfb2 on 16 Aug 2020 03:58:29

RE: Way to change datasource import to direct/live query

This worked very nicely for me (especially Step 11) - thanks for taking the time to write it up so thoroughly.