let BaseUrl = "https://hubwayconnect.com/HW/rest/odata/sales-order", EntityName = "OrderItem", FilterColumn = "UpdatedOn", FilterOperator = "ge", FilterValue = "2022-10-19T01:00:00Z", EntitiesPerPage = 1000, Filter = "$filter="& FilterColumn &" "&FilterOperator&" "&FilterValue, GetJson = (BaseUrl) => let Options = [ Headers = [ #"accept" = "application/json" ] ], RawData = Web.Contents(BaseUrl, Options), Json = Json.Document(RawData) in Json, GetEntityCount = () => let CountParam = "$count=true", Top = "$top="& Number.ToText(EntitiesPerPage), Url = BaseUrl & "/" & EntityName & "?" & CountParam & "&" & Top & "&" & Filter, Json = GetJson(Url), Count = Json[#"@odata.count"] in Count, GetPage = (Index) => let Skip = "?$skip=" & Text.From(Index * EntitiesPerPage), Url = BaseUrl & "/" & EntityName & Skip & "&" &Filter, Json = GetJson(Url), Value = Json[#"value"] in Value, EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }), PageCount = Number.RoundUp(EntityCount / EntitiesPerPage), PageIndices = { 0 .. PageCount - 1 }, Pages = List.Transform(PageIndices, each GetPage(_)), Entities = List.Union(Pages), Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(Table, "Column1", {"Id", "OrderId", "ProductId", "Quantity", "Discount", "Amount", "CreatedOn"}), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",) in #"Changed Type"