Forum Discussion
Share your thoughts on the New Power Query experience in Power BI Desktop (Preview)
Would you mind sharing more details about this scenario? Any repro steps would be helpful.
When you pass an identifier (query name, parameter name or even a step name) into the native query field then the gear icon is not available either in the legacy nor the new UI. If you then remove that Query field from the options record of something like SQL Server then it should bring back the gear icon.
If you could share the repro steps and what data source you're using, that would help us tremendously.
hi miguel ,
Here’s an example of how we use Power Query parameters with Value.NativeQuery. The SQL below is simplified, but it represents our actual use case:
WITH params AS (
SELECT
@start AS "startDate"
,@end AS "endDate"
)
,visits AS (
SELECT *
FROM visits v
WHERE 1=1
AND v.date >= ( SELECT "startDate" FROM params )
AND v.date < ( SELECT "endDate" FROM params )
)
SELECT *
FROM sales s
LEFT JOIN visits v ON v.id = s.visitId
WHERE 1=1
AND s.date >= ( SELECT "startDate" FROM params )
AND s.date < ( SELECT "endDate" FROM params )Because our operations move fast, we don't create DWH views for every report. Instead, we write SQL directly in Power Query using Value.NativeQuery, passing Power Query parameters like this:
[start = pq_start_date_parameter, end = pq_end_date_parameter]
This approach gives us two major benefits:
- Business users can change the reporting period in Power BI Service. They can update the parameters online without having to modify the SQL or rely on a developer.
- We can write more efficient and maintainable SQL. As the example shows, we can define parameters in a CTE and reuse them throughout the query. This is particularly useful when working with multiple CTEs and large tables, as it allows us to apply date filters early and avoid processing unnecessary data.
However, we also frequently need to edit our SQL in external tools such as DBeaver. Our usual workflow was to temporarily replace the parameter record:
[start = pq_start_date_parameter, end = pq_end_date_parameter] with null.
This made the small gear icon appear next to the Source step, allowing us to copy the SQL in its original, readable format, edit it in DBeaver, and paste the updated version back into Power Query.
Copying SQL directly from the Advanced Editor isn't a practical alternative. Power Query represents parts of the query using M-specific escape sequences. For example, double quotes in column aliases become """", while line breaks and indentation become #(lf) and #(tab). The result isn't valid, ready-to-run SQL that we can paste directly into DBeaver.
In the latest update, replacing the parameter record with null no longer makes the gear icon appear. This breaks our existing workflow: we can no longer easily extract the original SQL for editing in external tools.
Could you please restore this functionality or provide another straightforward way to copy the original SQL from a Value.NativeQuery step, including queries that use parameters?
For teams that work directly with SQL rather than creating a separate database view for every report, this is a significant productivity issue. We should be able to move between Power Query and SQL development tools without manually reconstructing or cleaning up the query every time.
Thanks!