Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Power Query - Identify Number Columns with Zero Values

Hi,

 

I'm trying to identify rows over values that have zero values so I can filter out these rows. To do this, I need to identify my number columns and search only those. There will be text columns in my data and there can be upwards of 50 different number columns, so creating a column including each individual column would be inefficient.

 

I've seen the following that could work:

= Table.AddColumn(PREVIOUS STEP, "Zero Value", each List.MatchesAll(Record.ToList(_),each _=0), type logical)

This allows me to create a logical column that I can filter. But it looks across all my columns, including those with Text.

 

The following code allows me to isolate just my number columns:

=Table.ColumnsOfType(PREVIOUS STEP, {type nullable number})

I want to know how I can blend these 2 together so my logical step only looks at my numerical columns.

 

Any idea how I would do this?

 

Thanks,

Mark

  • Anonymous try this:

     

    Table.AddColumn(#"Prev Step", "Custom", each List.MatchesAll(Record.ToList(Record.SelectFields(_,Table.ColumnsOfType(#"Prev Step", {type nullable number}))),each _=0))

2 Replies

  • Anonymous try this:

     

    Table.AddColumn(#"Prev Step", "Custom", each List.MatchesAll(Record.ToList(Record.SelectFields(_,Table.ColumnsOfType(#"Prev Step", {type nullable number}))),each _=0))
  • Anonymous's avatar
    Anonymous
    Not applicable

    parry2k  tremendous, that's exactly what I needed. Thanks for your help!