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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
srineo
Regular Visitor

M query to SQL

Hi all,

 

I use Import option and oracle SQL to pull data from source. Then i add few steps in powerbi to arrive final table data for visuals. I've also manually edited M query to include parameter in place of hardcoded literals in the original SQL statement. 

 

Problem is when i wanted to change the SQL logic i prefer Oracle SQL builder client to change/test my SQL then finally want to import in powerbi. I'm not able to view the orgianl SQL code which i imported in the 1st step to make any amendments. 

 

If i don't include the parameter in the M query then i can view the SQL code by double clikcing on 'source' step (1st step) whic is fine.  Is it a constraint that once I add parameter in the M query source code i no longer have access to original SQL code? Currently if any change to original SQL, i will have to start  a fresh Query in powerbi and repeat all the further steps which is not convinent if i have more steps. 

 

Or is there any tool to convert M query to SQL ?

 

Thanks,

Sri
Sri

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi srineo,

 

SQL statement is used to achieve data from database and load these data into power bi. Power Query is a built-in language which is often used to shape and transform data. So SQL statement can't replace M query. Inversely, the SQL statement is wrapped by M query function such as Sql.Database(server as text, database as text, optional options as nullable record). 

 

In addtion, if you are using query parameter in your sql statement, it means the table you achieved from database will be changed, every steps below should also be modified according to your requirement.

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi srineo,

 

SQL statement is used to achieve data from database and load these data into power bi. Power Query is a built-in language which is often used to shape and transform data. So SQL statement can't replace M query. Inversely, the SQL statement is wrapped by M query function such as Sql.Database(server as text, database as text, optional options as nullable record). 

 

In addtion, if you are using query parameter in your sql statement, it means the table you achieved from database will be changed, every steps below should also be modified according to your requirement.

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.