Bạn có thể bọc các trường nullable vào hàm IFNULL (), giống như sau:
DB::raw('(IFNULL(sales.taxable,0)
+ IFNULL(sales.non_taxable,0)
+ IFNULL(category_sales.amount,0)
+ IFNULL(department_sales.amount,0)
) as total_sales'),
DB::raw('0.0825*(IFNULL(sales.taxable,0)
+ IFNULL(category_sales.amount,0)
+ IFNULL(department_sales.amount,0)) as total_tax'))