Aug 03 2021 07:30 AM - edited Aug 03 2021 07:31 AM
Hi there,
I'm trying to make a filter like this:
let
Origen = Excel.Workbook(File.Contents("\Ubicaciones.xlsx"), null, true),
Ubicaciones_Table = Origen{[Item="Ubicaciones",Kind="Table"]}[Data],
hoja = workbook.getWorksheet("Hoja1"),
proyecto = hoja.getCell("B1"),
#"Tipo cambiado" = Table.TransformColumnTypes(Ubicaciones_Table,{{"Id", Int64.Type}, {"Name", type text}, {"IdProject", type text}}),
#"Filas filtradas" = Table.SelectRows(#"Tipo cambiado", each ([IdProject] = proyecto.getValue()))
in
#"Filas filtradas"
But doesn't work the "proyecto.getValue()".
Someone can help me?, it's my fist time I try to use a personalized filter in powerquery.
Many thanks.
Aug 03 2021 08:28 AM
What is the function proyecto.getValue() ? Perhaps it shall be simply
#"Filas filtradas" = Table.SelectRows(#"Tipo cambiado", each ([IdProject] = proyecto))
Aug 03 2021 08:35 AM
Aug 03 2021 09:04 AM
SolutionI got the answer,
As we can read here is not possible to do directly, bu we can fix it.
The result is here:
let
Origen = Excel.Workbook(File.Contents("\Ubicaciones.xlsx"), null, true),
Ubicaciones_Table = Origen{[Item="Ubicaciones",Kind="Table"]}[Data],
#"Tipo cambiado" = Table.TransformColumnTypes(Ubicaciones_Table,{{"Id", Int64.Type}, {"Name", type text}, {"IdProject", type text}}),
#"Filas filtradas" = Table.SelectRows(#"Tipo cambiado", each ([IdProject] = Excel.CurrentWorkbook(){[Name="code"]}[Content]{0}[Column1]))
in
#"Filas filtradas"
Many thanks.
Aug 03 2021 09:48 AM
I'd still use
p = Excel.CurrentWorkbook(){[Name="code"]}[Content]{0}[Column1])
within current query and after that "p" in filter. Much easier in maintenance.
Aug 03 2021 09:04 AM
SolutionI got the answer,
As we can read here is not possible to do directly, bu we can fix it.
The result is here:
let
Origen = Excel.Workbook(File.Contents("\Ubicaciones.xlsx"), null, true),
Ubicaciones_Table = Origen{[Item="Ubicaciones",Kind="Table"]}[Data],
#"Tipo cambiado" = Table.TransformColumnTypes(Ubicaciones_Table,{{"Id", Int64.Type}, {"Name", type text}, {"IdProject", type text}}),
#"Filas filtradas" = Table.SelectRows(#"Tipo cambiado", each ([IdProject] = Excel.CurrentWorkbook(){[Name="code"]}[Content]{0}[Column1]))
in
#"Filas filtradas"
Many thanks.