In this post, I’m gonna explain How to Edit Existing SQL Query in Power BI Desktop?

Edit Query in Power BI?
I have created a new Power BI Report using Power BI Desktop with SQL Server Database as a data source.

I have provided the below info:
- SQL Server Instance.
- Database Name.
- SQL Statement.

- I clicked OK, then I started working on the Dashboard.
- I implemented most of my dashboard requirements but I got new requirements that require editing the provided SQL query to add additional fields without adding a new data source in my model!
How to edit SQL Query in Power BI?
To edit an existing SQL query in Power Query in Power BI, you have to do the following:
Steps
- In the Home tab > Click on “Edit Queries” > Select “Edit Queries“.

- The “Power Query Editor” would be opened.
- On the left side, you can find the “Queries” list.
- Click on the query that you need to edit your SQL statement.

- On the right, you can find the “Query Settings” for the selected query.
- Below the “Applies Steps“, Click on the Setting icon gear besides the “Source” to edit the “Query Source“.

- The SQL Server database settings would be shown, you can edit your SQL statement as you prefer.

- Close & Apply.

You may also like to read Power BI: Switch from Import to DirectQuery Mode.
Applies To
- Power BI Report Server.
- Power BI Service.
Conclusion
In this post, I have explained How to edit SQL Server Database settings in Power BI by editing the source query form the Query settings in Power Query Editor.
Have a look at
- Install and Configure Power BI Report Server On-Prem.
- Duplicate vs Reference Query in Power BI
- Missing Save To Power BI Report Server In Power BI Desktop.
- Power BI: We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly.
- Calculate the Rows Count, Ignoring Filters In Power BI.
Thanks. Excellent article and really helpful 🙂