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
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
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.