对Power BI中的报表数据进行条件过滤

时间:2020-11-04 07:14:05

标签: powerbi

我有一个表条目,其中包含多个产品和许多不同的功能。所有数据都有显示格式的日期时间。

enter image description here

我们可以看到所有产品在不同时间都有条目。我的目的是在每天的最新时间过滤与产品相关的详细信息。

我能够在Date col和Time col中分别拆分Time col。

1 个答案:

答案 0 :(得分:0)

您可以通过在Dax中为例如创建一个新表来实现。 (因为我不知道您要对具有相同时间戳的行执行什么操作,所以我将显示C的两行)

enter image description here

YourFilteredTable =
VAR __trt =
    TREATAS (
        SELECTCOLUMNS (
            ADDCOLUMNS (
                SUMMARIZE (
                    ADDCOLUMNS (
                        ALL ( YourTable[Product], YourTable[Time] ),
                        "day", DATEVALUE ( YourTable[Time] )
                    ),
                    YourTable[Product],
                    [day]
                ),
                "MaxDate", CALCULATE ( MAX ( YourTable[Time] ) )
            ),
            "Prod", [Product],
            "MaxDate", [MaxDate]
        ),
        YourTable[Product],
        YourTable[Time]
    )
RETURN
    SUMMARIZECOLUMNS (
        YourTable[Product],
        YourTable[Quant],
        YourTable[Time],
        __trt
    )