cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johnwood
New Member

Converting an Excel source to SQL

Hi all

Using Power BI Desktop, i have created a series of dashboards which at present are sourcing data from a set of excel files created from various data sources, mainly Dynamics CRM.  I now want to convert from excel sources to direct SQL queries, without having ro revisit all my hard work!  Is there an easy way of doing this?

Many thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User IV
Super User IV

The easiest/safest way to do this is to probably create a new query to your SQL data source in Desktop and get it to a state such that all of the columns are the same names, etc. Basically so that you have two queries, your original to Excel and the new one to SQL that end up with exactly the same end table. Edit your 2nd query and go to View | Advanced Editor. Copy the "M" code. Edit your 1st query and go to View | Advanced Editor. Select all of your "M" code and replace it with the paste of your 2nd query.

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Greg_Deckler
Super User IV
Super User IV

The easiest/safest way to do this is to probably create a new query to your SQL data source in Desktop and get it to a state such that all of the columns are the same names, etc. Basically so that you have two queries, your original to Excel and the new one to SQL that end up with exactly the same end table. Edit your 2nd query and go to View | Advanced Editor. Copy the "M" code. Edit your 1st query and go to View | Advanced Editor. Select all of your "M" code and replace it with the paste of your 2nd query.

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Many thanks!  As with manythings in life, it's obvious once you know how 🙂

PowerBIGuy
Responsive Resident
Responsive Resident

@johnwood if i understood the question correctly you can also just goto File <- Import Excel workbook contents on Power BI Desktop. This will convert your Excel Files into PBI Files as described here

Business Intelligence Architect / Consultant

Hi PowerBIGuy

What I am doing is using excel extracts from our CRM system to generate data on which I am developing our BI reports.  In order to move the project into a production environment, I wanted to convert the source type to a direct SQL query, and the reply I got from SMOUPRE is exactly teh answer I was looking for!

Thanks!

John

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.