Forum Discussion
Use power bi parameters in a query through native query
- 4 years ago
Hi, Shiroe
You can refer to the solution proposed by kailas684 in this thread.
Step#1: Create Parameter pID [text parameter and keep default value]
Step#2: On Dataset that is pulled on Query Editor, right click and go to Advanced Editor. Edit below code as per your database and table name.
let
pID=ID,
Source =
Oracle.Database("your database name",
[HierarchicalNavigation=true,
Query="SELECT * FROM MYtableName#(lf) where DA_LOAN_ID='"&pID&"'"])
in
SourceBest Regards,
Community Support Team _ Eason
I'm late to this post. The answer from v-easonf-msft will work ok, but it's not what Shiroe was asking for and is clunky and limited for the exact reasons cited by OndrejVyhnal .
Value.NativeQuery works as expected on an Oracle database if you use the Oracle parameter syntax (which uses ':' to start a parameter name). For example:
let
Source = Oracle.Databases("localhost"),
Query = Value.NativeQuery(
Source,
"SELECT column1, column2 FROM example1 WHERE column1 BETWEEN :parameter1 AND :parameter2",
[parameter1 = Value1, parameter2 = Value2])
in
Query