In a microflow you could use a non persistant entity with a date attribute to store your event dates in (only create the object if the date is in the future) and add them to a list of that entity. If the list only consists of future dates, sort your list ascending on the date attribute. The head of the list will be your next date in the future. You should store this date in the 4th date attribute.
Hope this will help.
Do you need to show the last date relative to each other? Or do you need to show the date closest to now?
If it is the first, you could do your 4th date calculation in a before commit microflow but this will not work for the second logic.
Sounds like you need to use the ChangeObject activity to give attribute NextDate this value:
if ($MyObject/date1 > [%EndOfCurrentDay%]
and $MyObject/date1 < $MyObject/date2
and $MyObject/date1 < $MyObject/date3)
else if ($MyObject/date2 > [%EndOfCurrentDay%]
and $MyObject/date2 < $MyObject/date3)
else if $MyObject/date3 > [%EndOfCurrentDay%]
I would create 4 associations: three of them would be 1-1 as you suggest, one for each event (all the same entity). Then I'd also add another 1-*, which could contain all three of the events. Then you can retrieve an individual event easily, and you can also retrieve the list of events in any order you need them.
Does the datagrid need to be sorted by this 4th date? If not, seems like you would need to use a calculated attribute.
If you change your attribute from stored to calculated you can choose a microflow to run every time this attribute is displayed on the page. The microflow can do the the calculation described by Tim and return that date to be shown.
If your datagrid needs to be sorted by this date, then I suggest running a Daily scheduled event that does the calculation that Tim described. Since the calculation is relevant to current date time, then you would need to update your data daily.