Exclude rows from csv if two values both equal zero

Me again… I am trying to exclude rows from a CSV file if two of the columns equal zero in that row in the same row. The script Im using doesnt like me looking for two values. I have tried a comma and “and” and neither of the work.

Import-Csv C:\users\mburk\desktop\torxen.csv | where not {$_."Oil Volume" = 0},{$_."Water Volume" = 0} | Export-Csv C:\users\mburk\desktop\torxen2.csv -notypeinfo

Any thoughts?

Your syntax is wrong.

You have to enclose everything inside the script block of a Where-Object. And the equal sign (=) is the assignment operator not the comparison operator for equality. And you have to connect both conditions with an -and operator. And your code is easier to read when you write it more verbose and when you add a line break after each pipe symbol.

Import-Csv -Path 'C:\users\mburk\desktop\torxen.csv' | 
Where-Object  {-not ($_."Oil Volume" -eq 0 -and $_."Water Volume" -eq 0)} | 
Export-Csv -Path 'C:\users\mburk\desktop\torxen2.csv' -NoTypeInformation