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
akosiRandy
Frequent Visitor

How can I call a stored procedure in SQL Statement

In Ssrs, we can call a stored procedure with dynamic parameters,

 

EXEC usp_Client_Day @Start, @End, @MainCLient, @Client, 'CS,COS','NPG'

 

Quetion? How do you call a stored procedure with dynamic parameters in powerbi sql statement similar to the above code?

 

1 ACCEPTED SOLUTION

Thanks. I guess by default i should just create the data range parameter within sql statement and create the other parameters in powerbi visual.

View solution in original post

6 REPLIES 6
Idrissshatila
Super User
Super User

Hello @akosiRandy ,

 

Power bi doesn't support stored procedures, you must create it as a view and then connect to it through Power BI.

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote For my Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Thanks. I guess by default i should just create the data range parameter within sql statement and create the other parameters in powerbi visual.

ThxAlot
Super User
Super User

= Value.NativeQuery( Sql.Database("SqlSvr", "db"), "EXEC usp_Client_Day", {@Start, @End, @MainCLient, @Client, "'CS,COS'","'NPG'"} )


Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Thanks. Do you enter that code in SQL Statement dialog?

akosiRandy_0-1692820852747.png

 

marcelsmaglhaes
Super User
Super User

Hey @akosiRandy 
Take a look into this link: Power BI. Execute SQL Server stored procedure with a user parameter - Stack Overflow

Regards,
Marcel


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



foodd
Super User
Super User

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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