Forum Discussion
How to save data upload parameters. I'm uploading data from a website daily.
I'm uploading data from the same website on a daily basis. The only parameter that changes is the date. How can I save the upload parameters so that I don't have to fully re-create them every day?
Hi Tilly01Hill ,
I tried a workaround that might be helpful and included the screenshot along with the reference links for your convenience. Please note that a URL can have only one question mark any additional parameters should begin with an ampersand (&). Take a look and see if it meets your requirements. If you have any questions or encounter any issues, feel free to reach out.links:
https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Web_mechanics/What_is_a_URL
https://learn.microsoft.com/en-us/powerquery-m/web-contents
Thank you.
8 Replies
- SolomonovAntonSuper User
Goal: avoid rebuilding your web query every day by parameterizing the date, turning the query into a reusable function, and (optionally) enabling scheduled refresh/incremental refresh.
Approach A — Parameterize the date & build a reusable function (Power Query)
- Create a Date parameter
In Power Query: Home → Manage Parameters → New Parameter → Name DateParam, Type = Date, Current Value = today’s date (or any date to test). - Author a query for one date
Use Get Data → Web to connect once (with any test date). Confirm you can navigate to the table/JSON you need. - Convert to a function
Open the query’s Advanced Editor and parameterize the URL. Prefer Web.Contents with RelativePath/Query so the Service accepts dynamic parts (prevents “dynamic data source” errors).
Example (M) – Stable, refresh-safe pattern
let pDate = DateParam, BaseUrl = "https://api.example.com", DateText = Date.ToText(pDate, "yyyy-MM-dd"), Source = Web.Contents( BaseUrl, [ RelativePath = "reports/daily", Query = [ date = DateText ], Headers = [ Accept = "application/json" ] ] ), Json = Json.Document(Source), ToTable = Table.FromRecords(Json) in ToTable
Turn it into a function (so you can call it for any date):
(pDate as date) => let BaseUrl = "https://api.example.com", DateText = Date.ToText(pDate, "yyyy-MM-dd"), Source = Web.Contents(BaseUrl, [RelativePath = "reports/daily", Query = [date = DateText]]), Json = Json.Document(Source), Output = Table.FromRecords(Json) in Output
Now create a simple “runner” query that invokes the function with your parameter, so only the parameter needs updating each day:
let TodayData = fxGetDailyData(DateParam) in TodayDataDaily usage: change DateParam in Manage Parameters → Refresh. You never rebuild the query.
Approach B — Auto-pick “today” without manual edits
If the API always needs today’s date, compute it in M:
let TodayLocal = Date.From(DateTime.LocalNow()), Output = fxGetDailyData(TodayLocal) in OutputNote: Power BI Service evaluates “now” on the service’s region timezone (typically UTC). If the site is date-sensitive to your local time (Europe/London), consider offset logic:
let UtcNow = DateTimeZone.UtcNow(), LondonNow = DateTimeZone.SwitchZone(UtcNow, 0), // adjust if DST/region differs TodayUK = Date.From(DateTimeZone.RemoveZone(LondonNow)), Output = fxGetDailyData(TodayUK) in Output
Approach C — Append history + Incremental Refresh (no manual daily runs)
If the endpoint can return any past date, store historical rows and refresh only the latest window:
- Create parameters RangeStart and RangeEnd (Type = DateTime).
- Make your function accept a Date and filter rows by a date column between those parameters.
- In the model, right-click the table → Incremental refresh → choose “Store rows in the last N years/months/days” and “Only refresh last N days”.
- Publish and enable scheduled refresh. Only the recent window is fetched daily.
Example filter step (M)
let Raw = fxGetDailyData(Date.From(DateTimeZone.RemoveZone(RangeStart))), Filtered = Table.SelectRows(Raw, each [ReportDate] >= Date.From(RangeStart) and [ReportDate] < Date.From(RangeEnd)) in Filtered
Approach D — Parameter UI (Date picker) for ad-hoc runs
With a Date parameter, Desktop gives you a date picker. Change it once; the same parameter flows through all dependent queries.
Approach E — Offload the daily download (Power Automate / Dataflow)
- Power Automate: schedule a flow to call the site daily and drop JSON/CSV into SharePoint/OneDrive/Azure Blob. Power BI connects to that folder; each new file appends.
- Power BI Dataflow: build the parameterized query once in a Dataflow, define a parameter at the dataflow level, and schedule the dataflow. Your dataset then reads from the dataflow—no daily Desktop edits.
Important tips & pitfalls
- Dynamic Data Source error: avoid string-concatenated full URLs inside Web.Contents. Use base URL + RelativePath + Query as shown.
- Credentials: set them once (Desktop → publish → Service → Data source credentials). Parameters won’t force you to re-enter unless domain/authority changes.
- Rate limits: if the API throttles, add Retry-After handling (custom function with Function.InvokeAfter), or fetch smaller windows.
- Auditing: stamp the query date into a column so you can distinguish late-arriving corrections vs. original run.
Quick checklist (choose what fits your workflow)
- Desktop-only manual: use Approach A and just change DateParam daily.
- Fully automated in Service: use Approach B (compute today) + scheduled refresh.
- Growing history with fast refresh: use Approach C (Incremental Refresh).
- Enterprise ETL separation: use Approach E (Dataflow/Automate) and point your dataset at curated storage.
Helpful references (verified links)
- Power Query — Using parameters
- Power BI — Configure scheduled refresh
- Power BI — Incremental refresh overview
- Power Query M — Web.Contents
- Power Query documentation hub
- Power BI — Data refresh (concepts & limits)
- Chris Webb — RelativePath & Query options with Web.Contents (expert blog)
- Power Query — Web connector
✔️ If my message helped solve your issue, please mark it as Resolved!
👍 If it was helpful, consider giving it a Kudos!
- Create a Date parameter
- v-tejramaCommunity Support
Hi Tilly01Hill ,
Thank you SolomonovAnton for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you.- v-tejramaCommunity Support
Hi Tilly01Hill ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
- Tilly01HillRegular Visitor
Hi
Thanks for your reply and follow up email.
Please see the attached images showing the parameters that I'm using to try to import data from a website.
As you can see, I get the get the error message asking for the "anonymous" setting, which is how I've got the parameters set.
I've also included a screen shot of the Power Query, Transform data screen. How would I enter my data parameters into this screen? Would you be able to provide me with a sample screenshot please?
Regards
Steve Hill