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.
Hi Gurus
I am trying to pull information for certain US stocks from finance.yahoo.com
The web address follows a similar pattern for all stock symbols
https://finance.yahoo.com/quote/AAPL/key-statistics?p=AAPL
So I wrote a custom function
(Ticker) => try Web.Page( Web.Contents("https://finance.yahoo.com/quote/" & Ticker & "/key-statistics?p=" & Ticker,[Timeout=#duration(0,0,0,10)])) otherwise null
and invoked it over the symbols i have.
It works but is very slow when i use 500 + symbols
I read about function.scalarvector in Chris Webb's blog
https://blog.crossjoin.co.uk/2018/11/16/function-scalarvector-optimise-power-query-m-functions/
Please could you help me optimize the web queries using this or any other way
I tried with following. It works but does not optimize the query
Function.ScalarVector( type function(Tickersymbol as text) as text, (InputTable) => let BufferTable = Table.Buffer(InputTable), InputList = BufferTable[Tickersymbol], CallFunction = GetStatistics(InputList) in CallFunction )
Please the see the file for more clarity
https://drive.google.com/file/d/12C280ItzuSf7D6cYr-Nl8wj9NzuCeAxu/view?usp=sharing
Function looks as it should, so it might not be supported by the yahoo then.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
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 |
---|---|
112 | |
97 | |
82 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |