计算列:Distinct id# 应该 return 第一个日期并忽略其他日期

Calculated Column: Distinct id# should return first date and ignore other dates

我有一个要求,其中 id# 有重复的记录,也有重复的 received_date,我需要为每个 id# 显示唯一的接收日期。你能帮我解决这个问题吗?

数据示例如下:

我在计算列中尝试了以下

expected_date_or_result =
VAR selected_id = test[id#]
VAR distinct_received_date =
    CALCULATE (
        FIRSTDATE ( test[received_date] ),
        FILTER ( test, test[id#] = selected_id )
    )
RETURN
    distinct_received_date

我现在不确定在重复的情况下添加空格 received_date。

请帮我解决这个问题。

注意:我无法使用删除重复选项,因为它影响了我的列组

可能有很多方法可以解决这个问题,但这是我想到的第一个:

expected_date_or_result =
VAR TopRow =
    TOPN (
        1,
        FILTER ( test, test[id#] = EARLIER ( test[id#] ) ),
        test[received_date], ASC,
        test[group], ASC
    )
RETURN
    MAXX (
        FILTER ( TopRow, test[group] = EARLIER ( test[group] ) ),
        test[received_date]
    )

这会选择由 id# 过滤并由 received_dategroup 排序的 table 的第一行,然后过滤该行,使其仅非空如果 group 是最上面的并使用 MAXX.

提取 received_date