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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.