Forum Discussion
Select MIN of 4 Dates
- May 19, 2022
what do you mean by "current date"? isn't it the same with Date()?
see if the Conditions are met in the new function.
Hi, thanks for the response.
I have followed as above but I dont completely understand why I would lmite the results to 5. I would remove records that I need. Maybe I am not understanding or maybe I need to explain a bit further.
I have attached the output based on the query paramters above ( but I am showing ALL).
How would I bel able to return the MIN of the date for each ID?
I assume another query will need to be made. What is tricky is that I need to remove any dates in the past though so if it is a MIN in the record and if <Today then do not consider it.
I agree with Normalization, but if you are unable to do it, you can still get the Min Date by calling
a UDF (user defined function) from your Query.
See Module1 for the function.
Open Query1 that uses this function.
- Tony2021May 19, 2022Iron Contributor
HI Arnel, you are correct that I am not able to Normalize at this point. It would require a lot of rework. I know of this concept but didnt think to apply it to dates. I know this now so a good lesson brought up by George.
I have looked at the db udf and query. It looks great & performs as intended.
I did leave out a point since I was going to figure out a solution on my own but the function I do not understand how to modify and kindly ask your assistance.
What I need now is to return the MIN but I need to consider the current date.
I will try to summarize in english:
(1) If all dates are >Date() ===>return the MIN (as the UDF does now)
(2) Exclude any dates that are <Date() however if all Dates are <current date then return the MIN of those dates that are <current date.I hope its not confusing. Grateful for the assistance. thank you in advance. Happy to add more detail if needed.
- arnel_gpMay 19, 2022Iron Contributor
what do you mean by "current date"? isn't it the same with Date()?
see if the Conditions are met in the new function.
- Tony2021May 19, 2022Iron Contributorwow that was perfect! Tested and returns exactly as described. thank you very much! Have a good day Arnel / George and thank you for the great assistance and tips about normalization.