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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
s1
Helper I
Helper I

Power Query - Inserting rows into SQL gets repeated and inserts 3 times

I have a simple M script in a Data Flow. When I run a query with INSERT in SQL, it adds the row as I would expect. But I perform the same thing in my Data Flow, and just refreshing the preview causes it to add 3 rows for each row that is added in my insert statement.

Is there any way to make it only run once? Is there any way to make it perform a check before inserting so that even though it writes 3 times, only one gets saved by the SQL database?

 

let
  query = "INSERT INTO ...",
  dbWrite = Sql.Database(server, database, [Query=query, CreateNavigationProperties=false]),
in
  dbWrite

 

3 REPLIES 3
lbendlin
Super User
Super User

Do. Not. Do. That.

 

Power Query was never designed to write into anything except a Semantic Model.

 

There is NO guarantee that your Power Query will run only once.  Most of the time it will not.

 

Chris Webb's BI Blog: Why Does Power BI Query My Data Source More Than Once? (crossjoin.co.uk)

 

Repeat: Do. Not. Do. That.

If I shouldn't take this approach, is there any other way to save Dataflow Power Query results to a SQL database?

Don't use either Dataflows or Power Query.  Use a proper ETL tool like SSIS, or Informatica.  There is no need to drag Power BI into your data movement process.

 

If you are planning to use Fabric as a data storage this story becomes slightly different. Dataflows Gen 2 are designed to write into the Fabric lakehouse etc.

Helpful resources

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

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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

Top Kudoed Authors