'How to get the earliest date from another table in a one to many relationship?

I have these two tables. Both tables have a relationship by id (one to many)

TableA

id
1
2
3

TableB (date field is a date/time datatype)

id     date
1      1/01/2022 09:00:00
1      1/01/2022 11:00:00
2      1/01/2022 14:00:00
2      1/01/2022 18:00:00
2      1/01/2022 21:00:00
3      1/01/2022 09:00:00
3      1/01/2022 09:10:00

I require to add a calculated column in tableA that takes the earliest date of each id from tableB



Solution 1:[1]

You can use CALCULATE and FILTER DAX formulas to accomplish this

Date Lookup = 
CALCULATE(
    MIN(TableB[date]),
    FILTER(TableB,
    TableA[id]=TableB[id]))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1