Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
StevenHiatt
Frequent Visitor

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:

Max Date =
CALCULATE( MAX('Order Data'[Order Date]), FILTER(ALL(Dates), Dates[Date] <= TODAY()))

but that still gives me the latest date in the future. How can I get the date prior to today?

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Try:

Max Date =
CALCULATE( MAX('Order Data'[Order Date]), FILTER(ALL(Order Data), Order Data[Date]<= TODAY()))




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

Try:

Max Date =
CALCULATE( MAX('Order Data'[Order Date]), FILTER(ALL(Order Data), Order Data[Date]<= TODAY()))




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






parry2k
Super User
Super User

@StevenHiatt try this:

 

Max Date =
CALCULATE( MAX('Order Data'[Order Date]), Dates[Date] <= TODAY())

 

 

 

Follow us on LinkedIn and YouTube.gif 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.