在 Power BI Report Builder 中,以 Power BI 数据集作为数据源,如何编写具有多个过滤器的查询,其中一些过滤器是可选的?
例子:
在报告中,用户可以选择这些参数:
在 SQL 中,我是这样做的:
SELECT
*
FROM
Temp
WHERE
PaymentDate >= @P_PaymentDateFrom
and PaymentDate <= @P_PaymentDateTo
and IIF(@P_CustomerID = '', 1, CustomerID) = IIF(@P_CustomerID = '', 1, @P_CustomerID)
and IIF(@P_AffiliateID = '', 1, AffiliateID) = IIF(@P_AffiliateID = '', 1, @P_AffiliateID)
但是如何在 DAX 中做到这一点?