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.
Good day, this has been driving me up the wall for a few hours now, and goole isn't helping, so I have come to the experts 🙂
I have the following code in Power Query for a custom function I am working on:
let //Define Input Parameters Source = (Station as text, StartDate as date, EndDate as date) as table => let //Define API Parameters APIUrl = "https://mesonet.agron.iastate.edu/cgi-bin/request/asos.py?", StartYear = "&year1=" & Number.ToText(Date.Year(StartDate)), StartMonth = "&month1=" & Number.ToText(Date.Month(StartDate)), StartDay = "&day1=" & Number.ToText(Date.Day(StartDate)), EndYear = "&year2=" & Number.ToText(Date.Year(EndDate)), EndMonth = "&month2=" & Number.ToText(Date.Month(EndDate)), EndDay = "&day2=" & Number.ToText(Date.Day(EndDate)), //Combine parameters for URL RequestURL = APIUrl & "station=" & Station & "data=all&" & StartYear & StartMonth & StartDate & EndYear & EndMonth & EndDate & "&tz=Etc%2FUTC&format=onlycomma&latlon=no&missing=null&trace=T&direct=no&report_type=1&report_type=2", //Retrieve Source Data Source = Csv.Document(Web.Contents(RequestURL), #"Promoted Headers1" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]) in #"Promoted Headers1" in Source
But it fails with the error " Token Comma Expected" I have bashed my head on this for a while, and I can't seem to sort out where i've gone wrong in my syntax. The error is flagged on the 1st "in" statement.
Thanks for any help in advance!
Solved! Go to Solution.
@bstock -
You didn't close maybe?
Source = Csv.Document(Web.Contents(RequestURL),
as
Source = Csv.Document(Web.Contents(RequestURL)),
Proud to be a Super User!
@bstock -
You didn't close maybe?
Source = Csv.Document(Web.Contents(RequestURL),
as
Source = Csv.Document(Web.Contents(RequestURL)),
Proud to be a Super User!
#facepalm
Thanks. Seems the longer I stare at something the harder it is to find those things.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |