Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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: 

 

 

2. These are the parameters I enter:

 

 

 

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

 

Any help or insight would be appreciated!

 

Thanks!

 

Aaron

 

 

  • 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.

4 Replies

  • otravers's avatar
    otravers
    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

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

     

    Aaron

     

    • otravers's avatar
      otravers
      Community Champion

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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Got it, thanks again!