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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
pthapa
Post Patron
Post Patron

How can I pass a dynamic date to a date parameter in power bi

I wanted to pass the dynamic date to a EndDate Parameter in Power Bi, can someone please help me how do it.

 

Thank you in advance.

Pthapa

7 REPLIES 7
pthapa
Post Patron
Post Patron

For some reason complex quries or stored procedure doen't run on direct query mode.

It always gives following error;

pthapa_0-1701871562976.png

 

Try this: (How to use SQL Server stored procedures in Microsoft PowerBI? - Stack Overflow)

 

SELECT *
FROM OPENQUERY ([server name],
'EXEC dbname.dbo.spname @parametername = ''R1''');

 

pthapa
Post Patron
Post Patron

Hi,

I am using stored procedure from sql server in Import Mode that has Start and End Date as paramters. It doesn't allow me to bind the column to the parameter in Import Mode, as far as the Microsoft doc says. Also, when I swithced to Direct query, it loads the data however when I close and apply; throws some error. No matter it alwasy shows this error in Direct mode.

pthapa_0-1701722370166.png

So, I am still stuck, there has to be a way Power Bi can run the data based on the conditions I have.

Thanks

Having an SP is not ideal but should work.  Maybe you are hitting one of the other limitations

Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

 

Does the SP work in a standard direct query?

lbendlin
Super User
Super User

Bind the column to the parameter.

Hi Ben,

The sp runs without issues on standard mode (Import mode). I don't see it is part of any limitations that is explained in above link. As I have mentioned the dataset doen't contain the start and end date as available fields to bring them to the power bi slicer. My goal is to have user able to choose the startDate and EndDate in Power Bi to retrieve the data in the visual. This is the stored procedure created for SSRS reports where user has the parameter (startDate and EndDate) for them to select. I want to have same interface for user in power bi visual. Binding parameter is not available in my case.

Thanks,

The sp runs without issues on standard mode (Import mode)

Does it work in Direct Query mode?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors