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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
teado25
Frequent Visitor

Connecting to PostGRES SQL Database passing SQL query with dynamic parameters

Firstly I apologise in advance for any stupid questions. I'm new to Power Bi and PostGRES so I'm learning as I go.


I have connected to my database and setup and Import query in the 'Advanced Options' to run a daily report into Power BI. The problem is I need to be able to pass dynamic parameters to find the start (last working day accounting for holidays) and end date (current day). I've set the parameter using '"&StartDate&"'/'"&EndDate&"' and set the parameter as a text string and this is working within the import query.

 

Is there any way of populating a parameter using a query to establish the last actual working day automatically? I don't want the user to have to enter start and end dates every morning when they refresh the dataset. Long term we're investigating Azure which may eliminate this issue but for now I'm stuck!

 

Thanks in advance.

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

Replace the StartDate parameter formula query with:

= Date.StartOfDay(DateTimeZone.UtcNow())

You can just use DateTimeZone.UtcNow() if you want start of day to be UTCNow 

 

For EndDate use:

= StartDate + #duration(1, 0 , 0, 0)

 

Note: Depending on your timezone, you might need to adjust this if the server is in a different timezone than your data. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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