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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
CLEARIFY
Helper I
Helper I

MAX date within a column of dates (in a FACT table) that is less than or equal than today

I am looking for a simple calculation that finds the maximum date in a FACT table date field, that is less than or equal to todays date, and would say something like this:

 

CALCULATE(MAX(Table.Date where Table.Date is less than today

 

I have attempted many options including filter, etc. but not getting the correct value.

 

So for instance if I had a list of dates:

1/1/2020

6/3/2020

10/13/2020

12/15/2020

and today is 10/14/2020  my return would be 10/13/2020

 

I am using this to load a single variable that must contain the actual date (e.g. 10/13/2020.

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

Try this
CALCULATE(MAX(table[date]),filter(all(table[date]),table[date]<=today()))

 

It does depend if you are using a caledndar table, and how you will display the result, but i hope it helps.  



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @CLEARIFY ,

 

Is your issue solved?

I think what suggested by @amitchandak  may solve your issue, I made a pbix file for details if you needed,see attached.

Measure is as below:

Measure = CALCULATE(MAX('Table'[Dates]),FILTER(ALL('Table'),'Table'[Dates]<TODAY()))

And you will see:

Screenshot 2020-10-16 160930.png

 

If your issue still isnt solved,pls let me know.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

amitchandak
Super User
Super User

@CLEARIFY ,

Edited - Just saw already answered. It need < in this case.

Try like

calculate(max(Table[Date]), filter(Table, Table[Date] <Today()))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
MattAllington
Community Champion
Community Champion

Try this
CALCULATE(MAX(table[date]),filter(all(table[date]),table[date]<=today()))

 

It does depend if you are using a caledndar table, and how you will display the result, but i hope it helps.  



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors