The following source query returns the last 100 days. How can it be modified to return the last year?
= Web.Page(Web.Contents("https://finance.yahoo.com/quote/BMO.TO/history"))
Hi Ted,
Use this URL
https://finance.yahoo.com/quote/BMO.TO/history? period1=1595894400&period2=1627430400&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true
The periods are specified by Unix Timestamps. 1595894400 equates to 28 Jul 2020. You'll need to work out the timestamps to use based on the dates you want to retrieve Unix Timestamp - Epoch Converter - TimeStamp Converter
Regards
Phil
Thanks for the reply Phil ,
Being very new to Power Query, I'll have to play with this a bit.
Is this "?period1=1595894400&period2=1627430400&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true" just a part of the query line?
And, is it possible to frame a query that will always give me the last year without having to modify the query each time to specify the period start and end? This is part of an Excel workbook that I refresh frequently and with the number of stocks I want to track it would be cumbersome to have to modify the query each time.
Thanks again for taking the time to reply.
Ted
You could build a parameter query where you input the Date (Using the Unix Date/Time value) each time you wish to run the report in PQ. Here is a link on how to build a parameter query.