使用Calculatetable()

时间:2016-05-12 07:27:32

标签: powerpivot dax tabular

使用CALCULATETABLE()

时,我在表格过滤方面遇到了问题

我尝试使用带有CALCULATETABLE()条件的脚本:

XeroInvoices[AmountPaid] < XeroInvoices[AmountDue]      

EVALUATE
SUMMARIZE(
    CALCULATETABLE(XeroInvoices,
        XeroInvoices[Status] = "AUTHORISED",
        XeroInvoices[DueDate] <=  TODAY(),
        XeroInvoices[AmountPaid] < XeroInvoices[AmountDue]      
            ),
        XeroInvoices[Number],
        XeroInvoices[Reference],
        XeroInvoices[Status],
        XeroInvoices[Date],
        XeroInvoices[DueDate],
        XeroInvoices[AmountPaid],
        XeroInvoices[AmountDue]
        )

但是我在DAX Studio中遇到的错误如下:

Query (6, 30) The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.

我只是想实现我想要的只是这样 - 在SUMMARIZE()语法中创建新列,然后在Excel中过滤它:

EVALUATE
SUMMARIZE(
    CALCULATETABLE(XeroInvoices,
        XeroInvoices[Status] = "AUTHORISED",
        XeroInvoices[DueDate] <=  TODAY()       
            ),
        XeroInvoices[Number],
        XeroInvoices[Reference],
        XeroInvoices[Status],
        XeroInvoices[Date],
        XeroInvoices[DueDate],
        XeroInvoices[AmountPaid],
        XeroInvoices[AmountDue],
        "AmPaid<AmDue",XeroInvoices[AmountPaid]< XeroInvoices[AmountDue]
        )

有谁知道这个Err在CALCULATETABLE()中可能是什么原因以及可能提出的解决方案是什么?

谢谢!

1 个答案:

答案 0 :(得分:0)

检查this

要按多列过滤,您必须明确指定&#34; FILTER&#34;

CALCULATETABLE (
    Product,
    FILTER (
        Product,
        OR ( Product[Color] = "Red", Product[Weight] > 1000 )
    )
)