Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
JJCrone
Regular Visitor

JSON API Query Taking Parameters Expression.Error: We cannot convert a value of type List to type

Hello trying to create a custom fuction off a weather API but having an issue with the funtion, I send the link with out Power bi and it is success full here is what I can

 

JJCrone_0-1652402767086.png

 

 

 

 

 

let sqltext = (Location as text, Date as text, Key as text )  =>
let
    Source =  Json.Document((Web.Contents("https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/"& Text.Split(Location, " ")(0) & "%20" & Text.Split(Location, " ")(1) &"/"& Date &"?unitGroup=metric&include=days&key="& Key &"&contentType=json")))
in
    Source
in 
    sqltext

 

 

 

 

 

 

My error is 

 

JJCrone_1-1652402832472.png

 

 

I have tried it with out using the sqltext and it did not work either. 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @JJCrone 

 

I think it's because you are trying to access the List elements created by Text.Split but you've used () instead of {}

 

So change the braces to curly braces e.g.  Text.Split(Location, " "){0} 

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @JJCrone 

 

I think it's because you are trying to access the List elements created by Text.Split but you've used () instead of {}

 

So change the braces to curly braces e.g.  Text.Split(Location, " "){0} 

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.