This measure should return "Not In Stock" when the product is missing or BLANK() when it's not active or public or in expedition or stockroom. It can be used in a matrix visual with Product[Product] on the rows, then only the missing product would be listed.
Not In Stock =
IF(
ISINSCOPE( 'PRODUCT'[PRODUCT] ),
IF(
CALCULATE(
ISEMPTY( STOCK ),
'PRODUCT'[PUBLIC] = "Y",
COLORPRICE[ACTIVE] = "Y",
STOCK[LOCATION] IN { "stockroom", "expedition" }
),
"Not In Stock"
)
)
Edit:
to make it work at the EAN level, we can iterate over the COLORPRICE table and perform the check at the COLORPRICE row level. To aggregeate the result at the product level we may set a product Non In Stock when at least one of its EAN is out of stock. This is not tested, but I hope it will work :)
Not In Stock =
IF(
ISINSCOPE( 'PRODUCT'[PRODUCT] ),
IF(
SELECTEDVALUE( 'PRODUCT'[PUBLIC] ) = "Y",
IF(
SUMX(
FILTER( COLORPRICE, COLORPRICE[ACTIVE] = "Y" ),
IF(
CALCULATE(
ISEMPTY( STOCK ),
STOCK[LOCATION] IN { "stockroom", "expedition" }
),
1
)
) > 0,
"Not In Stock"
)
)
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…