简体   繁体   中英

Conditional Filtering on Report Data in Power BI

I have a table entry for multiple Product and Many different features. All the data has date time in shown format.

在此处输入图片说明

As we can see that all products has entries across different time. My aim is to filter the details related to the product by latest time of everyday.

I was able to split the Time col in Date col & Time col separately.

You can achieve that by creating a new table in Dax for eg. (because I don't know what do you want to do with rows with the same timestamp I show both rows for C)

在此处输入图片说明

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
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM