Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello world,
Absolute beginner here trying to get api data to always get today's date for below link:
= Json.Document(Web.Contents("https://api.carbonintensity.org.uk/regional/intensity/2024-02-06/fw48h/region/13/"))
I understand I need to replace 2024-02-06 with a function and I've tried several reiterations of the DateTime.LocalNow with no success.
I'm either getting an error that the query failed to get contents for the below:
= Json.Document(Web.Contents("https://api.carbonintensity.org.uk/regional/intensity/(DateTime.LocalNow())/fw48h/region/13/"))
or that there's a syntax.error ( Token ',' expected) if i try to put the function in "" as per below:
= Json.Document(Web.Contents("https://api.carbonintensity.org.uk/regional/intensity/"(Date.LocalNow())"/fw48h/region/13/"))
I know I must be absolutely butchering the format, but if any of you kind souls could please point me to the right solution here, I'd appreciate it very much!
Many thanks!
Solved! Go to Solution.
Hi @Anonymous ,
Can you try this? 🙂
Json.Document(Web.Contents("https://api.carbonintensity.org.uk/regional/intensity/" & Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd") & "/fw48h/region/13/"))
Let me know if this works for you 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Hi @Anonymous ,
Can you try this? 🙂
Json.Document(Web.Contents("https://api.carbonintensity.org.uk/regional/intensity/" & Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd") & "/fw48h/region/13/"))
Let me know if this works for you 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Thank you very much Tom! Worked like a charm and I really should start with learning the basics of the syntax 😊
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 7 | |
| 6 |