我正在尝试计算满足某些要求的 id 数量:
- a月收入超过1k
- a + 1 月收入低于 500
我如何在画面中实现这一点?我尝试使用以下计算字段:如果 {fixed [id],month[date]: sum(income)} >=1000 and {fixed [id],month[date]+1: sum(income)} <500 then 1 其他 0 结束
但不确定这种 month(date) + 1 方法是否在这里有效。
我正在尝试计算满足某些要求的 id 数量:
我如何在画面中实现这一点?我尝试使用以下计算字段:如果 {fixed [id],month[date]: sum(income)} >=1000 and {fixed [id],month[date]+1: sum(income)} <500 then 1 其他 0 结束
但不确定这种 month(date) + 1 方法是否在这里有效。
只需创建一个新的日期字段,向前移动 1 个月:
DATEADD('month',1,[Order Date])
对于这两个日期,右键单击 Custom-Date --> Month-Year,这样做您可以同时创建 Actaul 和 Shifted 日期。
然后,您只需要像这样的计算字段来计算具有该条件的所有月份:
sum(if { FIXED [Order Date (Month / Year)] : SUM([Sales])} >= 50000
and { FIXED [Order Date + 1 Month (Month / Year)] : SUM([Sales])} <= 100000
then 1
end
)