Forum Discussion
SebbyP333
Helper I
4 years agoHow to use an API string with reference to a dynamic table column?
Hello Power BI Forum, I have the following API url to pull in stock price data using the web function on Power BI Desktop. The part of the API url in red, bold and underlined is the stock code a...
- 4 years ago
SebbyP333 find attached
smpa01
Community Champion
4 years agoSebbyP333 you can dynamically pass on the string to the query
let
Stock = "MCD.US",
Source = Json.Document(Web.Contents("https://eodhistoricaldata.com/api/eod/"&Stock&"?from=2006-01-05&period=d&fmt=json&api_token=OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"date", "open", "high", "low", "close", "adjusted_close", "volume"}, {"date", "open", "high", "low", "close", "adjusted_close", "volume"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"date", type date}, {"open", type number}, {"high", type number}, {"low", type number}, {"close", type number}, {"adjusted_close", type number}, {"volume", Int64.Type}})
in
#"Changed Type"- SebbyP3334 years ago
Helper I
Where do I reference the table column with the list of stock codes within your query?