Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
chotu27
Post Patron
Post Patron

Execute SQL Server stored procedure input parameters with power bi parameters

Hi All,

 

I have stored procedure in SQL Server which i need to bring the data in to Power BI. For that i have to pass two parameters which i wanted to pass with parameters defined in Power BI.

 

Can anyone tell me how to do this it is very much important for my project?

1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

Hi @chotu27 

 

this is actualy pretty easy, once you have set up both parameters, in my case named CustomerID and ShipperID, just run the query with this M code:

 

=Sql.Database("server_name", "database_name", [Query="exec test_proc " & CustomerID & ", " & ShipperID])

 

 

 

Capture.PNG

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

2 REPLIES 2
rkaratzas
Helper I
Helper I

This assumes the query is already loaded (M-code interface). 

 

How do you get the query (that calls the stored procedure) loaded in the first place (so that you can use M-code)?

 

rkaratzas_0-1674849226194.png

 

 

 

LivioLanzo
Solution Sage
Solution Sage

Hi @chotu27 

 

this is actualy pretty easy, once you have set up both parameters, in my case named CustomerID and ShipperID, just run the query with this M code:

 

=Sql.Database("server_name", "database_name", [Query="exec test_proc " & CustomerID & ", " & ShipperID])

 

 

 

Capture.PNG

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.