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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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