请求:计算逾期的已购买订单数。应用过滤器时重新计算。
背景:有3个表:
关系:** Purchase_Orders -1 PO_DIM 1 - Received_Orders
衡量Sudo代码:
1. CountRows
2. Filter for rows where Purchase_Orders[Promised Date] is not Blank()
3. Filter for rows where Received_Orders[Received Date] is Blank()
4. Filter for rows where Purchase_Orders[Promised Date] < Today()
你会如何解决?
答案 0 :(得分:0)
我会将3个过滤器需求转换为一个FILTER函数,使用RELATED来测试其他表中的列,如:
Count PO Pastdue =
CALCULATE (
COUNTROWS ( 'PO_DIM' ),
FILTER (
'PO_DIM',
NOT ( ISBLANK ( RELATED ( Purchase_Orders[Promised Date] ) ) )
&& ISBLANK ( RELATED ( Received_Orders[Received Date] ) )
&& RELATED ( Purchase_Orders[Promised Date] ) < TODAY ()
)
)