Native Runtime Parameter Preservation for Value.NativeQuery() in Power BI
Current Behavior
Value.NativeQuery() supports parameter placeholders during Power Query preview evaluation, but parameter bindings are not preserved during DirectQuery runtime execution after Close & Apply.
This causes runtime SQL execution failures such as:
Must declare the scalar variable @Param -- for MS SQL Server database
OR
ORA-01008: not all variables bound -- for Oracle database
when the DirectQuery engine reconstructs SQL without rebinding parameters.
Why Existing Alternatives Are Insufficient
1. String Concatenation
Unsafe for text parameters.
Example:
Value.NativeQuery(
Source,
"SELECT * FROM Table WHERE Name = '" & Param & "'"
)
Problems:
- SQL injection exposure
- manual escaping complexity
- loss of type-safe parameterization
- inconsistent query plans
2. Stored Procedures
Not viable in many enterprise/vendor-managed environments:
- read-only access
- no schema modification permissions
- SaaS/vendor-controlled databases
3. Query Folding
Folding applies transformations after source query generation in many cases.
This does not support scenarios where parameters must:
- alter joins
- constrain CTEs
- influence optimizer behavior
- reduce scanned partitions
- control source-side execution logic
Suggested Feature
Add official runtime parameter binding support for Value.NativeQuery() in DirectQuery mode.
Value.NativeQuery(
Source,
"
SELECT *
FROM Sales
WHERE SaleDate >= @StartDate
AND SaleDate < @EndDate
",
[
StartDate = StartDateParam,
EndDate = EndDateParam
]
)
with guaranteed preservation of:
- parameter metadata
- parameter values
- parameter types
- prepared statement semantics
through the full DirectQuery execution pipeline.
Additional Enhancement Ideas
Microsoft could strengthen the proposal further with optional features like:
A. Typed Parameter Contracts
[
StartDate = type date,
CustomerId = Int64.Type
]
to ensure providers bind correctly.
B. Safe Dynamic Lists
Support:
WHERE Region IN @RegionList
with structured array binding instead of string expansion.
Why This Matters
This capability would:
- improve security
- reduce SQL injection risk
- improve DirectQuery performance
- support enterprise governance
- enable vendor-managed read-only environments
- align Power BI with modern parameterized query behavior available in other BI/data platforms
Recent ideas
Allow Workspace Admins to View Power BI Semantic Model Configuration Without Requiring Take Over
a { text-decoration: none; color: #464feb; } tr th, tr td { border: 1px solid #e6e6e6; } tr th { background-color: #f5f5f5; } Description As a Power BI Workspace Administrator, I understand why own...LeonardGreene2 hours agoNew MemberNew6Views0likes0CommentsOpen Fabric notebooks in View‑only by default
Problem: Developers and reviewers with edit permissions frequently open notebooks for reading. Notebooks currently open in edit mode with autosave, which causes accidental changes and noisy version h...AMD07912 hours agoAdvocate IVNew334Views11likes1CommentService principal authentication support for data sources in Paginated(RDL) reports
We are only seeing two options(Basic, OAuth2) for data source authentication in a paginated report, Recently we see that the Service principal authentication enabled for Power BI(PBIX) reports, simi...Thatikonda_Vams2 hours agoNew MemberNew134Views6likes2CommentsMetadata-Driven Copy Job Control at Table and Column Level
We currently achieve metadata-driven table and column selection in Copy Data activities by using dynamic queries. This allows us to dynamically determine which tables and columns should be processed ...Motasim097 hours agoNew MemberNew6Views0likes0CommentsDynamic ForEach Parallel Batch Count Based on Runtime Capacity
We would like Microsoft Fabric Data Factory to support dynamic configuration of the ForEach activity's parallel batch count at runtime. Currently, the ForEach batchCount is effectively configured as...Motasim097 hours agoNew MemberNew4Views0likes0Comments