cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
Community Champion

Try:

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

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

2 REPLIES 2
Community Champion

Try:

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

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

Super User

@StevenHiatt try this:

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

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.

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors