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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
KM007
Helper II
Helper II

Timeout issue

Hi

 

I have a timeout issue see below ...

 

2018-01-05 01_15_03-.png

After searching for a solution I added [Timeout=#duration(0,0,15,0)]) to the query but the issue remains.

Below is my code ...

let

// Function for each Sector-Information
WebCall = (SectorID as text) =>
let
    Source = Web.Page(Web.Contents("http://www.hl.co.uk/funds/fund-discounts,-prices--and--factsheets/search-results?sectorid="&SectorID&"&lo=2&filters=0%2C1%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&page=1&tab=prices",[Timeout=#duration(0,0,15,0)])),
    Custom1 = Source{[ClassName="table-styled table-sortable"]}[Data],
    ListOfAllPages = if List.Count(List.Skip(Text.Split(Custom1{0}[Name], "#(lf)")))=0 then {"1"} else List.Skip(Text.Split(Custom1{0}[Name], "#(lf)")),
    #"Converted to Table" = Table.FromList(ListOfAllPages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    RearragnedURL = Table.AddColumn(#"Converted to Table", "Custom", each Web.Page(Web.Contents("http://www.hl.co.uk/funds/fund-discounts,-prices--and--factsheets/search-results?tab=prices&sectorid="&SectorID&"&lo=0&page="&[Column1]&"")){[ClassName="table-styled table-sortable"]}[Data]),
    #"Expanded Custom" = Table.ExpandTableColumn(RearragnedURL, "Custom", {"Name", "Name2", "Current price Sell (p)", "Current price Buy (p)", "Current price Change (p)", "Yield", "More information", "Go to"}, {"Name", "Name2", "Current price Sell (p)", "Current price Buy (p)", "Current price Change (p)", "Yield", "More information", "Go to"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each not Text.StartsWith([Name], "Page:")),
    #"Changed Type" = try Table.TransformColumnTypes(#"Filtered Rows",{{"Name", type text}, {"Name2", type text}, {"Current price Sell (p)", type number}, {"Current price Buy (p)", type number}, {"Current price Change (p)", type number}, {"Yield", Percentage.Type}, {"More information", type text}, {"Go to", type any}}) otherwise null
in
   try #"Changed Type" otherwise null,

// Start of main query: Dig into Html to retrieve a table with all Sectors
    Source = Excel.Workbook(File.Contents("C:\Users\PC\Google Drive\Finance Docs\HL\HL Sector IDs.xlsm"), null, true),
    #"HL Sector IDs_Sheet" = Source{[Item="HL Sector IDs",Kind="Sheet"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(#"HL Sector IDs_Sheet",{{"Column1", Int64.Type}, {"Column2", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Column1] <> null)),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"Column1", "Custom.1"}, {"Column2", "Sector"}}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns",{{"Custom.1", type text}}),
   
// Call function and cleanup
    CallEachFunction = Table.AddColumn(#"Changed Type2", "WebCall", each WebCall([Custom.1])),
    FilterOutEmpties = Table.SelectRows(CallEachFunction, each ([WebCall] <> null)),
    ExpandColumns = Table.ExpandTableColumn(FilterOutEmpties, "WebCall", {"Column1", "Name", "Name2", "Current price Sell (p)", "Current price Buy (p)", "Current price Change (p)", "Yield", "More information", "Go to"}, {"Column1", "Name", "Name2", "Current price Sell (p)", "Current price Buy (p)", "Current price Change (p)", "Yield", "More information", "Go to"}),
    #"Changed Type1" = Table.TransformColumnTypes(ExpandColumns,{{"Current price Sell (p)", type number}, {"Current price Buy (p)", type number}, {"Current price Change (p)", type number}, {"Yield", type number}}),
    #"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"Custom.1", "SectorID"}, {"Column1", "Page no."}}),
    #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns1",{"Name2", "Yield", "More information", "Go to"}),
    #"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1),
    #"Renamed Columns2" = Table.RenameColumns(#"Added Index",{{"Current price Sell (p)", "Sell (p)"}, {"Current price Buy (p)", "Buy (p)"}, {"Current price Change (p)", "Change (p)"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns2", "Date", each DateTime.LocalNow()),
    #"Extracted Date" = Table.TransformColumns(#"Added Custom",{{"Date", DateTime.Date, type date}}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Extracted Date",{{"Index", Int64.Type}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type3", "Unique ID", each Text.From([Index])&[Name]),
    #"Changed Type4" = Table.TransformColumnTypes(#"Added Custom1",{{"Unique ID", type text}})
in
    #"Changed Type4"

My Excel file the code above refers to contains :-

 Search by sector
121Asia Pacific Ex Japan
114Asia Pacific Inc Japan
155China/ Greater China
111Europe Excluding UK
102Europe Including UK
117European Smaller Companies
115Flexible Investment
150GBP Corporate Bond
151GBP High Yield
152GBP Strategic Bond
109Global
106Global Bonds
112Global Emerging Markets
156Global Emerging Markets Bond
139Global Equity Income
126Guaranteed/Protected
113Japan
132Japanese Smaller Companies
137Mixed Investment 0-35% Shares
131Mixed Investment 20-60% Shares
107Mixed Investment 40-85% Shares
123Money Market
999N/A
110North America
130North American Smaller Cos
71Offshore
400Pension Trusts
108Property
138Short Term Money Market
129Specialist
136Targeted Absolute Return
134Technology & Telecoms
101UK All Companies
105UK Corporate Bond
104UK Equity & Bond Income
103UK Equity Income
127UK Gilt
135UK Index Linked Gilt
118UK Smaller Companies
125Unauthorised
48Unclassified
1 REPLY 1
v-caliao-msft
Microsoft Employee
Microsoft Employee

@KM007,

 

How many records in your Excel file? You can upload any Excel workbook smaller than 1 GB to Power BI. If your Excel file is larger than 1GB. You could ave it to OneDrive for Business, connect to it from Power BI, and view it in Excel Online. Please refer to the link below to see the details.
https://docs.microsoft.com/en-us/power-bi/reduce-the-size-of-an-excel-workbook

 

Regards,

Charlie Liao

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.