Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个表达:
(Current Year / Last Year ) - 1
这给了我当年的% change。
如果有新人加入,数据库将没有去年的数据,
这会导致#Error出现在该字段的表单上。我不想出现这种情况有什么我可以做的吗?
在查询中使用IIf表达式在[Last Year]不是 Null 时返回计算值,在为 Null 时返回[Last Year]Null。
IIf
[Last Year]
SELECT IIf(Nz([Last Year], 0) > 0, ([Current Year] / [Last Year]) - 1, Null ) AS percent_change FROM YourTable;