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.
I am attempting to use a function to iterate through 1 list and 1 column to perform an api call.
The function looks like this:
(agentID as text, dayDate2 as date) as table => let Source = Xml.Tables(Web.Contents("https://api.url.com/api/stats/agents/"& agentID &"/statistics?d=" & Date.ToText(#date(Date.Year(dayDate2),Date.Month(dayDate2),Date.Day(dayDate2)),"yyyy-MM-dd"))), Table0 = Source{0}[Table] in #"Table0"
The table calling the function looks like this:
let DateRange= List.Dates(#date(2019,01,01),365,#duration(1,0,0,0)), agentID = #"agent-id", Source = List.Transform(DateRange, each try {(_), #"2Params"(List.Transform(agentID,each _),_)} otherwise null), Table0 = Source{0}[Table] in #"Table0"
I've tried a bunch of iterations and different ways to get both parameters to the function but cannot seem to do so.
Any suggestions would be helpful.
Thank you
Hi @Anonymous ,
How about changing the code as below?
(agentID as text, dayDate2 as date) as table => let Source = Xml.Tables(Web.Contents("https://api.url.com/api/stats/agents/"& agentID &"/statistics?d=" & Date.ToText(#date(Date.Year(&dayDate2),Date.Month(&dayDate2),Date.Day(&dayDate2)),"yyyy-MM-dd"))), Table0 = Source{0}[Table] in #"Table0"
Unfortunately, it is not allowing me to enter that in the advanced editor, returning the error "expecting token literal"
I was under the assumption the issue is with my 'agent-id' list and how I am parsing it.
here is the associated error I am getting -
Expression.Error: We cannot apply field access to the type List. Details: Value=List Key=Table
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 |
---|---|
100 | |
99 | |
80 | |
77 | |
66 |
User | Count |
---|---|
134 | |
106 | |
105 | |
86 | |
72 |