Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I'm using the function Json.Document to get data from an API. Below is the an example of the Json.Document value:
Json.Document(Web.Contents("https://url.com/site/222222/energyDetails?xxx&startTime=2022-07-21%2011:00:00&endTime=2022-08-26%2013:00:00&api_key=xxx"))
I would like to change the startTime and the endTime value dynamically with values coming from another table. Is it possible ?
Maybe something like this:
Json.Document(Web.Contents("https://url.com/site/22222/dateDetails?xxx&startTime=2022-07-21%2011:00:00&endTime="#Table1[endTime]"&api_key=xxxx"))
Many thanks in advance for your help.
Solved! Go to Solution.
Welcome to the wonderful world of the formula firewall. Happy reading.
Behind the scenes of the Data Privacy Firewall - Power Query | Microsoft Docs
Inline your queries if possible.
Hi,
thanks for your recommandation.
After reading the Query option for the Web.Contents(), I used the web.contents like below:
= Json.Document(
Web.Contents(
"https://url.com/site/222222",
[
RelativePath="energyDetails",
Query=
[
grid="XXX",
startTime=DateTime.ToText(#"Site Data - Start and End Date"[dataPeriod.startDate]),
endTime="2022-08-29 13:00:00",
api_key="xxx"
]
]
)
)
the options "startTime" and "endTime" are from another table "Site Data - Start and End Date" which contains two columns:
I got the the problem below when i'm executing the code above:
What's wrong with the startTime value ? how can I fix that ?
Thanks in advance for the help
Regards,
startTime=DateTime.ToText(#"Site Data - Start and End Date"[dataPeriod.startDate]){0}
Thanks @lbendlin for your feedback.
I still have the same error message after adding "{0}":
startTime=DateTime.ToText(#"Site Data - Start and End Date"[dataPeriod.startDate]){0}
I tried to added inside the DateTime.ToText() function and I got the error message as below :
startTime=DateTime.ToText(#"Site Data - Start and End Date"[dataPeriod.startDate]{0})
Any help ?
Welcome to the wonderful world of the formula firewall. Happy reading.
Behind the scenes of the Data Privacy Firewall - Power Query | Microsoft Docs
Inline your queries if possible.
read about the Query option for Web.Contents()
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
69 | |
64 | |
51 | |
36 | |
26 |
User | Count |
---|---|
85 | |
55 | |
45 | |
44 | |
36 |