您好,我努力计算结果,但仍然是错误的,希望任何人都可以提出建议。预先非常感谢。
所需结果::要在[产品表]中有一个计算列,以显示该产品是否具有基于[仓库表]和[库存表]中的过滤器的库存。
过滤逻辑:
基于[库存表],以查看在“区域” BJ中此SKU是否存在在线产品的库存
基于第一步的结果,在[产品表]中显示不要出现在先前过滤结果中的SKU
我的代码:
=
IF (
CALCULATE (
COUNTROWS ( 'Inventory' ),
FILTER (
'Inventory',
'Product'[IfOnline] = "Online " && RELATED ( 'Warehouse'[Region] ) = "BJ"
)
)
> 0,
"BJ has inventory",
"BJ has no inventory"
)
表关系如下:
答案 0 :(得分:0)
这应该有效:
[column] =
IF (
[IfOnline] = "Online"
&& CALCULATE (
COUNTROWS('Inventory'),
Warehouse[Region] = "BJ"
)
> 0,
"BJ has inventory",
"BJ has no inventory"
)
对“数量”列求和而不是对行进行计数甚至会更好。如果数量为0。
[column] =
IF (
[IfOnline] = "Online"
&& CALCULATE (
SUM('Inventory'[Qty]),
Warehouse[Region] = "BJ"
)
> 0,
"BJ has inventory",
"BJ has no inventory"
)