Forum Discussion
Mat42
4 years agoResolver I
Max/Min Calculated Column
This is either going to be easy or horribly complicated. Let's say I ave a simple table of data: Name Date Dave 01/01/2021 Dave 01/01/2021 Dave 02/02/2019 Dave 01/01/2021 ...
- 4 years ago
Your calculated column needs to look like:
Min Date = CALCULATE ( MIN ( Person[Date] ), ALLEXCEPT( Person, Person[Name] ) )
If you just did MIN on it's own it would find the minimum date in the whole column.
CALCULATE forces a context transition that moves all the columns in the current row into the filter context.
However CALCULATE ( MIN ( Person[Date] ) ) will just return the date of the current row because CALCULATE has included the date column in the filter.The solution above tells calculate to remove the filters from everything apart from Person[Name].
amitchandak
4 years agoSuper User
Mat42 , Based on what I got
new columns
Min date = minx(filter(Table, [Name] =earlier([Name]) ), [Date])
Max date = maxx(filter(Table, [Name] =earlier([Name]) ), [Date])