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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Executing SQL Server Stored Procedure With User Parameter(s) In Power BI

Hello  @amitchandak
@v-yuta-msft
@v-yulgu-msft
@V-lianl-msft
@Anonymous,

 

I have connected power BI with a stored procedure from a SQL Server database. I get results returned when I run the Stored Procedure in SQL Server but when I invoke a function after entering my parameters in Power Query I only get column headers and an empty table.

I have used the following URL resources to get to this point but still no positive results:

https://www.c-sharpcorner.com/article/execute-sql-server-stored-procedure-with-user-parameter-in-pow...

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

I will supply pictures to help bring my issue into context:

 

1. This is my "M" Code: 

 

aaronrogers_4-1657148524601.png

 

2. These are the parameters I enter:

 

aaronrogers_2-1657147957310.png

 

 

3. This is the returned result set in PowerBI after the  function in invoked:

aaronrogers_3-1657148174399.png

 

Any help or insight would be appreciated!

 

Thanks!

 

Aaron

 

 

1 ACCEPTED SOLUTION
otravers
Community Champion
Community Champion

I'd try removing the spaces between the double quotes and single quotes and I'd doublecheck the data types of the parameters in the stored procedure.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Yes! Data was returned. Thanks You! What is the reason behind the importance of spacing with the quotes?

 

Aaron

aaronrogers_0-1657212055850.png

 

There was space that ended up being part of the parameter passed to the stored procedure.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals
Anonymous
Not applicable

Got it, thanks again!

otravers
Community Champion
Community Champion

I'd try removing the spaces between the double quotes and single quotes and I'd doublecheck the data types of the parameters in the stored procedure.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors