'How can I add a column with find the closest date found in a second table using dax or m?
I have two tables. One with dates of tech support given, and the other one with surveys sent to the customers. The problem is that the surveys are sent some days after the service is done. So I need to find the closest date from the survey table and bring it to my tech support table. Here's a sample of my data and the result wanted. I appreciate any help!
Table1:
TechSupportDate
01/12/2018
02/12/2018
05/12/2018
Table2:
SurveyDate
04/12/2018
10/12/2018
12/12/2018
Expected Result:
TechSupportDate SurveyDate
01/12/2018 04/12/2018
02/12/2018 04/12/2018
05/12/2018 10/12/2018
Solution 1:[1]
Add a calculated column to Table1:
SurveyDate =
CALCULATE (
MIN ( Table2[SurveyDate] ),
FILTER (
Table2,
Table2[SurveyDate] >= Table1[TechSupportDate]
)
)
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 | Olly |