- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit Existing SQL
Hi All,
Once i import data through Get data> SQL Server > providing the query in the SQL statement window, is it possible to modify that SQL...? (a SQL with complex calculations for our requirement).
cuz i built few viz's and dont wanna create another query item so that i use the same dataset(Query) to be modified which i see in my data fields for ease..!!
any help will be appriciated.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can modify it by clicking on the wheel on the source Step in the query settings
or modify the Query parameter in the Advanced editor
/erik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The method that @aahmed showed returns the correct explanation. If you just try to go through the edit queries section at the top you will recieve the greyed out box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The method that @aahmed showed returns the correct explanation. If you just try to go through the edit queries section at the top you will recieve the greyed out box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@aahmed - what if the Source "wheel" is non-existent (and when I right click, the "Edit Settings" is greyed out) - I can see this feature on some tables in my pbix file but not others. It seems as though the wheel/edit feature shows up if the query is ONLY referencing one table, but if the query has a JOIN then the wheel/edit feature is not available. Have you experienced this? Any suggestions for a workaround here? Editing the queries with the JOINs are the most cumbersome (I copy/paste into Notepad++ then "replace all" of the #(lf) and then reverse those steps after I've edited my query in SSMS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know this is an older thread but I am also looking for an answer to this exact question currently, anyone have any documentation would be much appreciated 👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Click on Advanced Editor. I think it's available by right clicking the query pane on the left. If not, certainly in the menu
* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Power Query has a "split query" option to break a query into 2 pieces. hence you can break your query into a "source" and then transformation this way. Then you can point to the new source and create a new query from that.
In my experience, I tend to write my queries in SSMS first, then paste them into the Query window when creating a new query. I find it easier and more flexible. The only exception is if you want to use Query Folding with a table from within Power BI, then it is better to use a native query.
* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @MattAllington I don't know u got me wrong or i did...!!
I too follow the same SSMS way. But what um asking is, once um done with
1. writing SQL in SSMS and then Copying that SQL statement in
2. Get Data> SQL Server > SQL Statement Window,
3. Importing the data / Loading the data in the report (PBI Desktop)
can i modify the query which i wrote at the get data in 2nd step...??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can do that via the Applied Steps in your Query editor or using the advanced editor via the View tab and then modify your M/Power Query script
Or even better create a parameter and use that parameter in your query
/Erik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi @donsvensen um not aware of M/Power Query Script and i got a few modfications in my query through updating the previous SQL statement in SSMS. i want to use the updated SQL instead of the SQL i provided to the report before.
should i create another data connection and add another query to the report with the updated SQL is this the only choice do i have..??
or
is there anyway to update the old SQL of the Existing Query..?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can modify it by clicking on the wheel on the source Step in the query settings
or modify the Query parameter in the Advanced editor
/erik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried changing an SQL statement changing the source; but the SQL statement area is greyed out (impossible to change the text).
Thanks for your help

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
01-16-2020 04:55 PM | |||
10-17-2024 08:21 AM | |||
04-24-2024 08:48 AM | |||
02-21-2023 07:14 AM | |||
Anonymous
| 01-18-2021 01:26 PM |
User | Count |
---|---|
141 | |
117 | |
80 | |
65 | |
47 |