Forum Discussion

SandraJ's avatar
SandraJ
New Member
5 years ago
Solved

Power Query - Add an Average Column from other columns in the table excluding zeros from Avg Calc

I'm new to Power Query and need help with adding an average column that would average a few columns in the table but exclude column with values of zero from the average calcuation.    For example: ...
  • Jakinta's avatar
    5 years ago

    You can try this

     

     

    = Table.AddColumn(#"YourTable", "Custom", each List.Average(List.RemoveMatchingItems({[Column1],[Column2],[Column3]},{0})), type number)

    or

     

    = Table.AddColumn(#"YourTable", "Custom", each List.Average(List.Select({[Column1],[Column2],[Column3]},each _<>0)), type number)

     

  • Jakinta's avatar
    Jakinta
    5 years ago

    The easiest way is to replace null with 0 in next step.