Felipe Melo
Felipe Melo

Reputation: 3

Delete or ignore rows that have empty tables when using Table.ExpandTableColumn | Power Query

I need to expand a table column but some of the table contents are empty and return "" when I run the query it stops at the first table where the content is empty.

I need to ignore these rows when using the Table.ExpandTableColumn or delete them beforehand.

#"Função Personalizada Invocada" = Table.AddColumn(#"Tipo Alterado", "generation_24hrs", each get_generation_24([user.data.id])),
#"generation_24hrs Expandido" = Table.ExpandTableColumn(#"Função Personalizada Invocada", "generation_24hrs", {"entry.value.id", "entry.value.kwh_ger", "entry.value.kwh_con"}, {"entry.value.id", "entry.value.kwh_ger", "entry.value.kwh_con"})

Before

Before

After:

After

Upvotes: 0

Views: 723

Answers (1)

horseyride
horseyride

Reputation: 21318

try

#"Função Personalizada Invocada" = Table.AddColumn(#"Tipo Alterado", "generation_24hrs", each get_generation_24([user.data.id])),
#"Added Custom" = Table.AddColumn(#"Função Personalizada Invocada", "RowCount", each Table.RowCount([generation_24hrs])),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([RowCount] <> "0")),
#"generation_24hrs Expandido" = Table.ExpandTableColumn(#"Filtered Rows", "generation_24hrs", {"entry.value.id", "entry.value.kwh_ger", "entry.value.kwh_con"}, {"entry.value.id", "entry.value.kwh_ger", "entry.value.kwh_con"})

Upvotes: 1

Related Questions