Forum Discussion
John2029
4 years agoFrequent Visitor
Display closest date between 2 date columns from 2 different tables
Hello, I have 2 tables. Table 1: column countries andcolumn dates Table 2: column countries and column dates I am trying to create a table where I display 3 columns: 1) a column countries from...
- Anonymous4 years ago
Hi John2029 ,
Please try:
Date Tab 2 = VAR _t = ADDCOLUMNS ( 'Table 2', "DateDiff", VAR _tab1 = LOOKUPVALUE ( 'Table 1'[Date Tab 1], [Country], [Country] ) RETURN DATEDIFF ( [Date Tab 2], _tab1, DAY ) ) VAR _minDiff = MINX ( FILTER ( _t, [Country] = EARLIER ( 'Table 1'[Country] ) ), ABS([DateDiff])) RETURN [Date Tab 1] + _minDiffOutput:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kmeadows123
2 years agoRegular Visitor
John2029 Hello! Sorry to dig this up, but I am dealing with the exact same situation. Did you find the proper solution to find the closest dates between the two tables, leaving the duplicates rows?