Apr 23 2020 01:41 AM
hi,
Can anyone tell me if it is possible to "remove empty columns" as it is to "remove empty rows"?
Thanks Juan
Apr 24 2020 07:15 AM
SolutionIf automatically that could be function like
(Source as table) as table =>
let
RemoveEmptyColumns = Table.SelectColumns(
Source,
List.Select(
Table.ColumnNames(Source),
each List.NonNullCount(Table.Column(Source,_)) <> 0
)
)
in
RemoveEmptyColumns
Apr 24 2020 02:39 PM
Depending on your table size, you could transpose the table in PQ, then filter out blank rows on a column, then transpose back.
To keep the column headers though, you should demote the headers before you transpose, then promote them after you transpose the table back.
Apr 24 2020 07:15 AM
SolutionIf automatically that could be function like
(Source as table) as table =>
let
RemoveEmptyColumns = Table.SelectColumns(
Source,
List.Select(
Table.ColumnNames(Source),
each List.NonNullCount(Table.Column(Source,_)) <> 0
)
)
in
RemoveEmptyColumns