https://peterkellner.net/2013/10/13/creating-a-compound-nullif-in-avg-function-with-sqlserver/