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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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!:
The Definitive Guide to Power Query (M)

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!:
The Definitive Guide to Power Query (M)

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors