Forum Discussion
Find Max Date Prior to Today
I have order data with dates both in the past and in the future. It is connected to a date calendar table. I would like to find the most recent date prior to today.
For example, if today was April 15, 2022 and I had order dates in my table of:
April 1, 2022
April 5, 2022
April 11, 2022
April 19, 2022
April 30, 2022
I would want it to return 'April 11, 2022'. I will then use this date to show last 30 days totals, etc.
I've tried:
but that still gives me the latest date in the future. How can I get the date prior to today?
Try:
Max Date =CALCULATE( MAX('Order Data'[Order Date]), FILTER(ALL(Order Data), Order Data[Date]<= TODAY()))
2 Replies
- PaulDBrown
Community Champion
Try:
Max Date =CALCULATE( MAX('Order Data'[Order Date]), FILTER(ALL(Order Data), Order Data[Date]<= TODAY())) - parry2k
Super User
StevenHiatt try this:
Max Date = CALCULATE( MAX('Order Data'[Order Date]), Dates[Date] <= TODAY())✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.