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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
mohittimpus
Helper V
Helper V

How to get as per the latest datetime ?

Hello,

I'm trying to get a value from table which has a recent datetime.


I'm trying this logic but its not working :

 

CALCULATE (
    AVERAGE ( table[values] ),
    FILTER ( ALL ( table ), table[DateTime] >= MAX ( table[DateTime] ) )
)

Thank you.
3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

Measure =
VAR __time = MAX( table[DateTime] )
RETURN
    CALCULATE( AVERAGE( table[values] ), table[DateTime] >= __time )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

Hi, @mohittimpus 

Please correct me if I wrongly understood your question.

Please check the below picture and the measure, whether it is what you are looking for.

 

Picture6.png

Last sales total =
LASTNONBLANKVALUE( 'Table'[Date], [Sales total])
 
 
The link is down below.
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

amitchandak
Super User
Super User

@mohittimpus , Try like

 

measure =
var _max = Maxx( ALL ( table ), table[DateTime] ) //OR //Maxx( ALLSelected ( table ), table[DateTime] )

return
CALCULATE (
AVERAGE ( table[values] ),
FILTER ( ALL ( table ), table[DateTime] =_max )
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.