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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gvg
Post Prodigy
Post Prodigy

How to set parameter for current date to be used in Source

Hello,

I need to extract contents of a web page like this : 
    https://SomeWebPage/?date=25/1/2023

My problem is that I have to specify the date (which is today's date) every time I extract data. I can build today's date dynamically but then I can not set automatic refresh in Power BI Service.
I am trying to set today's date via parameter but parameters do not allow to use formula like DateTime.LocalNow()). What is the way out? 

4 REPLIES 4
MAwwad
Super User
Super User

  1. Use a Power Query function to dynamically generate the current date. You can use the DateTime.LocalNow() function in Power Query to get the current date and time, and then use the Date.ToText() function to format the date in the format that is required for the web page URL. This will allow you to refresh the data in Power BI Service and the date parameter will be updated automatically.

  2. Use a custom function in Power Query to generate the current date and assign it to a parameter. You can create a custom function in Power Query that takes the current date and formats it in the required format. Then, you can assign that parameter to the date parameter in the web page URL.

  3. Use a measure to return the current date. You can create a measure in Power BI that returns the current date and use it in the web page URL.

Use any of these options

@MAwwad , I created the current date with this code:

let
Source = Text.End("0" & Text.From(Date.Day(DateTime.LocalNow())),2) & "." & Text.End("0" & Text.From(Date.Month(DateTime.LocalNow())),2) & "." & Text.From(Date.Year(DateTime.LocalNow()))
in
Source

Not sure what to do next. How do I assign it to parameter? 

@gvg
Did you find the solution to automatically configure the data in the parameter?

No 😞

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors