如何通过带有过滤器的另一个表的三列在Power BI中创建一个新表?

时间:2020-10-06 14:19:48

标签: powerbi dax

我有一个表在索引列中有重复的值,第三列仅在某些行中有值

我现在拥有的桌子:

Table I have now

我的目标是创建一个新表,该表选择CompanyID,Start Date和Contact Date列,但从其中任何一个中排除具有空值的行

我想要的新表

New table I want to have

我使用了以下DAX代码:

CALCULATETABLE (
    Table,
    FILTER ( Table, NOT ( ISBLANK ( Table[Start Date] ) ) )
)

此代码的问题是它选择了我原始数据的所有350+列,而不是只包含我想要的3列。此外,我不知道如何添加其他过滤器,因此我没有“联系日期”和“ ComapanyID”的空白行

我也尝试了下面的代码,但是没有用

CALCULATETABLE (
    Table,
    FILTER ( Table, NOT ( ISBLANK ( Table[Start Date] ) ) ),
    FILTER ( Table, NOT ( ISBLANK ( Table[Order Date] ) ) ),
    FILTER ( Table, NOT ( ISBLANK ( Table[Employee Count] ) ) )
)

1 个答案:

答案 0 :(得分:0)

SELECTCOLUMNS函数使您可以选择特定的列。

例如:

New Filtered Table =
EVALUATE
SELECTCOLUMNS (
    CALCULATETABLE (
        Table,
        NOT ( ISBLANK ( Table[Start Date] ) ),
        NOT ( ISBLANK ( Table[Order Date] ) ),
        NOT ( ISBLANK ( Table[Employee Count] ) )
    ),
    "CompanyID", Table[CompanyID],
    "Contact Date", Table[Contact Date],
    "Start Date", Table[Start Date]
)