Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Super User

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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

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

@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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors