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

How to pass dynamic date parameter to stored procedure in power bi?

Hi.

I am developing a report for the financial sector with the aim of monitoring the default rate. To do this, I created a stored procedure that organizes the database, allowing the SQL program to return outstanding securities considering that specific date when a base date is entered.
The report is designed to visualize the default status of customers up to a certain date (base date). Therefore, it is necessary to provide a parameter whenever the report is analyzed, ensuring that the information is updated and consistent with the desired period. However, I am unable to pass a parameter from a slitter, for example, to the query.

 

Imagem2.png

This is just a draft with some items that will be used, it is far from being the final version of the front-end.

 

I would like to know if it is possible via Power BI to pass parameters from a slicer to Power Query.

Imagem3.png

In Power Query I can pass a fixed parameter, but I was unable to interact with a parameter selected in the Parameter field (Data set).Imagem1.png

1 ACCEPTED SOLUTION
DiegoThp
Frequent Visitor
3 REPLIES 3
DiegoThp
Frequent Visitor

jgeddes
Super User
Super User

You should be able to add a line to your Query1 to format the SQL query. The use that line in the query call.

queryText = "EXEC sp_GetTitulos '" & dataset & "'",
Source = Sql.Database(SERVERNAME, DATABASENAME, [Query=queryText]




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

Proud to be a Super User!





I don't know if I understood. I summarized the M instruction and changed it according to your guidance and it works.

 

let
datasetOriginal = Text.From(Parameter1),
queryText = "EXEC sp_GetTitulos " & datasetOriginal,
Source = Sql.Database("SERVER", "DATABASE", [Query = queryText])
in
Source

 

However, I didn't understand how to change it dynamically in Power BI.

 

I need to pass the parameter dynamically from Power BI to Power Query.

 

Captura de tela 2025-03-20 160626.png

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.