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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Add NOLOCK syntax into Power Query

Hi,

 

We are connecting our dataset from SQL Server to Power BI and we want to include the NOLOCK syntax to avoid the lockage of DB during the scheduled data refresh time under Import mode.

Anyone can suggest how to put the syntax in place to make it work?

 

Already tried the following syntax in the Advance Editor but having error message in the below screen shot, tried many different ways to debug this but seems not working......anyone can suggest how to fix this?

 

=======================

let
 Source = Sql.Database("xxx.com", "XYZCompany"),
dbo_OrderedItemSummary = Sql.Database("xxx.com", "XYZCompany",[Query="SELECT * FROM dbo.OrdereditemSummaryPermissionGroup (NOLOCK)"]),

#"Duplicated Column" = Table.DuplicateColumn(dbo_OrderedItemSummaryPermissionGroup, "PermissionGroup", "PermissionGroup - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"PermissionGroup - Copy", "UserId"}}),
#"Expanded UserId" = Table.ExpandRecordColumn(#"Renamed Columns", "UserId", {"UserPermissionGroup"}, {"UserId.UserPermissionGroup"}),
#"Expanded UserId.UserPermissionGroup" = Table.ExpandTableColumn(#"Expanded UserId", "UserId.UserPermissionGroup", {"UserId"}, {"UserId.UserPermissionGroup.UserId"}),
#"Renamed Columns1" = Table.RenameColumns(#"Expanded UserId.UserPermissionGroup",{{"UserId.UserPermissionGroup.UserId", "UserId"}})
in
#"Renamed Columns1"

=======================

 

image.png

 

Here is how the table OrderedItemSummaryPermissionGroup looks like from DB.

image.png

 

Best regards,

Emily

 

4 REPLIES 4
smiglo
Frequent Visitor

Hi it seems using NOLOCK clause in direct query makes you to use a 'native query' mode that does not support query folding (needed for incremental refresh). It seems better option is to create a view from a table and add NOLOCK clause in there .

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can always create views that include (NOLOCK) and use these views in Power Query

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi @Mariusz 

 

Can I simply include NOLOCK in the Advance Editor in Power Query instead of creating new views?

Thanks.

 

Best regards,

Emily

Hi, did you figure out the syntax for adding NOLOCK to the Advanced Editor in Power Query?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Top Solution Authors