Forum Discussion
Pass Parameters from a SP in SQL into parameters created in Power BI(which can accept values)
- 10 years ago
radz if i understood you correctly,
you need to create a query first to sql server that executes a sp with hard coded value for parameter. then once data loaded in power bi right click that query and click create a function and craeate. Once function is created you need to right click -> Advanced Editor and replace code to parameterise hard coded values that will be supplied to sp parameter. hope that make sense.
- 10 years ago
Hi @ankitpitara
Yes it made sense and helped me. Thanks.
But instead of creating a function, I directly replaced code in the Query created by going to Advanced Editor, to parameterize the hard coded values.
This was done by adding Power Bi Parameters by concatenating them using &.
Thanks for your help.
hi guys - can yo show an actual example of the code you used here? I'd really appreciate it - thanks!
Hi FergaIK
example could be
let
Source = Sql.Database("x", "x", [Query="Select distinct .Dates D where d.DatesAgo Between 0 and "&ToDate&" "])
in Source
best,
Mads
- Anonymous9 years agoNot applicable
Thanks for the info Mads, I will try that out and let you know how it goes
Fergal
- Anonymous9 years agoNot applicable
now that I think of it - maybe that won't work, as that's just a parameter in a SELECT statement, what I need is how to code the paramater into an OPENQUERY parameterised stored proc.
Here's the connection string as an example of what I'm trying to do:
= Sql.Database("myserver", "mydatabase", [Query="SELECT * FROM OPENQUERY ([myserver, 'EXEC mystoredproc @param1= ??? ')#(lf)", CreateNavigationProperties=false]
Any help/advise is much appreciated!
Fergal
- BalaVenuGopal8 years agoResolver I
Dear All ,
i can able to send parameter to sql server by entering value in text box (By edit parameters tab)
Can i get dropdown with auto populate values from database to choose values
- smfaizhaider8 years agoRegular Visitor
BalaVenuGopal, you can achieve this by options available in 'Manage Parameter' , in 'Suggested Values' you can provide 'List of values' or get values using a 'Query'.