Forum Discussion
Reduce loading time during refresh
Thank you Seward!
I did a dinamic date table to filter the two tables, a table with old values and a table with fresh ones.
Besides that, the timing to load the fresh datas is to high.
Below you can see the code I used:
This is for the old datas:
let
Source = #"Pesquisa Base",
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name.1", type date}}),
// #"Filtered Rows1" = Table.SelectRows(#"Changed Type", each [Name.1] > #date(2018, 1, 2)),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each (List.ContainsAny(startdate,{[Name.1]}))),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name.1"}),
#"Invoked Custom Function" = Table.AddColumn(#"Removed Columns", "GetFiles", each GetFiles([Path])),
#"Expanded GetFiles" = Table.ExpandTableColumn(#"Invoked Custom Function", "GetFiles", {"Dia", "Hora", "Qtd"}, {"Dia", "Hora", "Qtd"}),
#"Removed Columns2" = Table.RemoveColumns(#"Expanded GetFiles",{"Path"})
in
#"Removed Columns2"
This is for the fresh ones:
let
Source = #"Pesquisa Base",
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name.1", type date}}),
// #"Filtered Rows1" = Table.SelectRows(#"Changed Type", each [Name.1] > #date(2018, 1, 2)),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each not (List.ContainsAny(startdate,{[Name.1]}))),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name.1"}),
#"Invoked Custom Function" = Table.AddColumn(#"Removed Columns", "GetFiles", each GetFiles([Path])),
#"Expanded GetFiles" = Table.ExpandTableColumn(#"Invoked Custom Function", "GetFiles", {"Dia", "Hora", "Qtd"}, {"Dia", "Hora", "Qtd"}),
#"Removed Columns2" = Table.RemoveColumns(#"Expanded GetFiles",{"Path"})
in
#"Removed Columns2"
Here we have the 'startdate' for the fresh datas
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type1" = Table.TransformColumnTypes(Source,{{"Data", type date}}),
Data = #"Changed Type1"[Data]
in
Data
I forgot to write the old data is not refreshed with refresh all and have a macro to refresh it