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
gramespa
Frequent Visitor

Add SQL statements in advanced window or rebuild in M

Hi all,

I am connecting Power BI to a SQL Database and need some sql statements to create a new table based on joining several other tables with similar keys. Some have relations some dont. 

 

I have no trouble building what i need in SQL but i am not so sure about doing it in M.

Is it "best practice" to add SQL statements directly as advanced option or connect to Database and rebuild what i need in M? And if so is there any guidance how to transfer common statements like Select, cast, join, where etc?

 

Thank you all1

2 REPLIES 2
VasTg
Memorable Member
Memorable Member

@gramespa 

 

If you are using advanced window to run the SQL, some of the features like query folding can't be achieved.

 

But I always go with it because I know my SQL is right, tune it, bring in only the necessary columns and rows etc.

 

All I do in M query is to select the datatype and/or add custom/conditional columns for sorting,grouping etc..

 

On the flip side, If yo do it with M query, it has to read all the rows and transform the data in the way you need in Power BI.

 

But is it a "Best practise", I don't know. Test both the approaches and see which one loads faster.

 

If this helps, mark it as a solution

Kudos are nice too.

Connect on LinkedIn

Thank you for sharing you opinion in this! Since data size is not an issue in this case i might go for the advanced window and be sure what i am doing is correct.

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