Forum Discussion
parameters to SP or Sql query
- 10 years ago
Thank you so much. Will give this a go as soon as possible.
- 10 years ago
By the way, this work fine. Thanks so much. Now I need to find out how to update the parameters in PowerBI.com so that i can refresh the data as needed. Thanks again.
Hi MRZ,
I made a test to call stored procedure with parameters in Power BI Desktop. You can review the following example to apply it to your scenario.
In SQL Server, I create a procedure named p4test in test database of v-kaxion2015tes\sql2016tabular server.
Create PROC p4test @sdate date,@edate date AS BEGIN SELECT @sdate StartDate, @edate Enddate END
1. In Query Editor of Power BI Desktop, click "New source"> "SQL Server", enter server name, database name and statement "exec p4test '8/11/2016', '8/12/2016'", click ok.
2. Right click on that query on the left panel and select Advanced Editor, and paste the below code.
let
SQLSource = (param1 as date, param2 as date) =>
let
Source = Sql.Database("v-kaxion2015tes\sql2016tabular", "test", [Query="exec p4test '"& Date.ToText(param1) & "','" & Date.ToText(param2)&"' #(lf)#(lf)#(lf) #(lf)"])
in
Source
in
SQLSource
3.Click “Invoke” button and enter parameter values as shown in the following screenshot.
Thanks,
Lydia Zhang
Hi Anonymous,
I'm dealing with something like this but this doesn't work for me. I want, in the step 3, fill these values with the value from an app. It's is possible? Full post is available here.
Thanks in advance
Julian
- rohitpaliwal8 years agoNew Member
Guys do we've a solution for this, I've similar requirement, I've got four drop downs in my report
1. Country
2. State
3. City
4 Store
the navigation is working fine, but I've a requirement to take this to next level i.e. in each drop down I've option to select either one or all, now once the selection is made, I want to use this as a input parameter for a stored procedure which resides in my sql server database.
I understand that in the new query editor I can use the stored procedure but how do I populate the parameter from the drop down visualization i.e. slicer in my case (I can use some other visualization aslo), first will list country, second will have states, third will have city and fourth will have storeIDs, now I can either have all selected or any indivudial values and on the basisi of this select tion, my procedure should execute like below
exec dbo.myproc countryid = @countryvar, stateid = @statevar, cityID = @cityID, storeDi = @storeID
- Anonymous4 years agoNot applicable
Hey, can you find any solution or workaround, to this? pls share in any