A where-clause should do the trick
$clu=get-clusterClustername
$esx=$cluster|Get-VMHost|Where {$_.ConnectionState-eq"Connected"}
$statcpu=Get-Stat-Entity ($esx) -start (get-date).AddDays(-7) -Finish (Get-Date) -MaxSamples10000-statcpu.usage.average
$cpu=$statcpu|where {$_.Value-ne0} |Measure-Object-Propertyvalue-Average-Maximum