Forum Discussion
BryceJones
1 year agoFrequent Visitor
A calculated column or custom column that compares two date columns output which date it is closest
Hello all, I need to create either a calculated column in DAX or a custom column in PowerQuery that compare two date columns in two tables. The output is a column that has the value in the second...
- 1 year ago
Hi BryceJones ,
You can achieve your goal by creating a new calculated column in first table with this DAX:
Closest Date = VAR CurrentBeginDate = 'FirstTable'[Begin Date] RETURN MINX( FILTER( 'SecondTable', 'SecondTable'[Date] > CurrentBeginDate ), 'SecondTable'[Date] )Your output will look like this:
amitchandak
Super User
1 year agoBryceJones , A new column in Table 1
Maxx(filter(Table2, Table2[Date] >= Table1[Start Date] && Table2[Date] <= Table1[End Date]) , Table2[Date])
BryceJones
1 year agoFrequent Visitor
Thank you. To clarify Begin Date and Date are the only dates in my scenario that need this comparison performed on.