March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all,
I'm trying to pass an Excel cell value as a parameter to a native query (on a Progress database in Power Query in Excel).
I know how to pass an Excel cell value as a parameter to filter a table within Power Query. But we are working with big datasets, so I would like to apply the filter before the data is loaded. In this simple example I would like to replace ib240.cdstatus = ‘O’ by ib240.cdstatus = MyParameter.
let
Source = Odbc.Query("dsn=Extended", "Select#(lf) ib240.cdorder,#(lf) ib240.cdstatus#(lf)From#(lf) PUB.""ib-240"" ib240#(lf)Where#(lf) ib240.cdstatus = 'O'")
in
Source
I have tried using this example https://blog.crossjoin.co.uk/2016/12/11/passing-parameters-to-sql-queries-with-value-nativequery-in-...
My first step was to get this to work without using my parameter, like this:
let
Source = Odbc.Query("dsn=Extended", "data"),
Test = Value.NativeQuery(
Source,
"Select
ib240.cdorder,
ib240.cdstatus
From
PUB."ib-240" ib240
Where
ib240.cdstatus = 'O'
")
in
Test
But then I'm getting an error:
Can someone help me out here?
Hello @ArjanVos
You can add your parameter like this
let
Source = Odbc.Query("dsn=Extended", "Select#(lf) ib240.cdorder,#(lf) ib240.cdstatus#(lf)From#(lf) PUB.""ib-240"" ib240#(lf)Where#(lf) ib240.cdstatus = '" & MyParameter & "'")
in
Source
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hi Jimmy, almost a yea further now... Your solution seems to work only for parameters that I have defined within Power Quer but not for parameters that come from a cell value like in this link: https://exceleratorbi.com.au/pass-excel-parameter-power-query/
It then says this (in Dutch):
Freely translated: Query <Name> (step Source) refers to other queries or steps and therefore possibly doesn't have access to a data source. Make this data combination again.
Can we get this to work, so that we can make it as easy as possible for the end user to enter the parameters?
Hi @ArjanVos ,
Try checking the symbol in the table name on line 9 according to the error message.
PUB.""ib-240"" ib240
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
35 | |
31 | |
20 | |
19 | |
17 |