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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
chenchen_voc
New Member

Using M-code in the Advanced Editor to load data in the Direct Query Mode

hi Experts,

My question is, how to load data in direct query mode via M-code in the advanced editor?

 

I am aware of how to load data from the Home ---> GetDate button.

 

But when I create a blank query, and try to load data using M-code in the advanced editor the new table will be loaded in Import mode. This is not what I want to have. 

 

This is the M code I have to load the data.  see this example.

let
    Source = Snowflake.Databases(#"ServerName",#"WarehouseName",[Role=#"RoleName"]),
    Database = Source{[Name=#"DatabaseName",Kind="Database"]}[Data],
    Schema = Database{[Name="EXAMPLE",Kind="Schema"]}[Data],
    Table = Schema{[Name="DIM_CLASS",Kind="Table"]}[Data]
in
    Table

 

Could you helo me to change my M code? Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @Anand24 , Allow me to offer another insight:

Hi, @chenchen_voc 

If you want to use Direct Query mode when connecting to Snowflake, then you need to use the officially certified Snowflake connector, you can refer to the following official documentation:

Power Query Snowflake connector - Power Query | Microsoft Learn

vjianpengmsft_0-1715917515772.png

vjianpengmsft_1-1715917529713.png

If you use M code, as you say by super user, you won't be able to convert to Direct Query mode. 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
Anand24
Super User
Super User

@chenchen_voc ,
You don't need to do anything in M query to change connection mode to DirectQuery. All you need to do is go to model view -> click on the table -> Expand advanced properties -> Switch storage mode to DirectQuery

Refer below screenshot:

Anand24_0-1715682741614.png

 

 

Hi Anand, thanks for your reply.

 

However, I can not convert this table into direct query mode. It has been set the import mode by default when I load the table with the M query. So I can not change it as your solution showed. 

Thanks!

 

Chen

Anonymous
Not applicable

Thanks @Anand24 , Allow me to offer another insight:

Hi, @chenchen_voc 

If you want to use Direct Query mode when connecting to Snowflake, then you need to use the officially certified Snowflake connector, you can refer to the following official documentation:

Power Query Snowflake connector - Power Query | Microsoft Learn

vjianpengmsft_0-1715917515772.png

vjianpengmsft_1-1715917529713.png

If you use M code, as you say by super user, you won't be able to convert to Direct Query mode. 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.