【发布时间】:2022-11-04 21:35:27
【问题描述】:
但是,如果要在查询函数中聚合总计,Col2 和 Col3 中有空值,则总计值会导致空值。如何将查询函数中的空值替换为零值以允许算术运算符计算正确的结果?
=Query(QUERY(sampledata,"select D, COUNT(C) where A = 'Supplied' AND M = 'Recommended' group by D pivot B order by D"),"Select Col1,Col2,Col3,Col3+Col2, (Col2/(Col3+Col2)) label Col3+Col2 'Total', (Col2/(Col3+Col2)) 'Action Rate' 格式 Col1 'dd-mmm-yyyy', Col2 '#,##0', Col3 '#,##0', Col3+Col2 '#,##0', (Col2/(Col3+Col2)) '#,##0.0%'")
尝试使用普通 SQL 函数,如 ISNULL 和 COALESCE
合并(Col3,0) ISNUL (Col2, 0)
但是,这些在表格中不起作用。
【问题讨论】:
标签: google-sheets google-sheets-formula google-query-language