web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / DateTime filter not wo...
Power Apps
Answered

DateTime filter not working correctly

(0) ShareShare
ReportReport
Posted on by 4
I'm using the DateTime.IsInPreviousNHours() in Power Query to filter out files older than 14 days (336 hours).  I'm seeing an issue where it's mistakenly filtering out files that have a very recent timestamp.  See the before and after screenshots below where the 2 most recent files are being filtered for some reason.
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    SpongYe Profile Picture
    5,616 Super User 2025 Season 2 on at
    Hi @BS-31012226-0
     
     
    You are missing the 2 records of 1700 and 1715 because the Date modified is within the current hour. 
    Please check the documentation of the function DateTime.IsInPreviousNHours.
     
    "Indicates whether the given datetime value dateTime occurs during the previous number of hours, as determined by the current date and time on the system. Note that this function will return false when passed a value that occurs within the current hour."
     
    Hope this help you.
  • Verified answer
    BS-31012226-0 Profile Picture
    4 on at
    @SpongYe - Ahh, thank you very much!  I see now it's essentially taking the floor of the hour, rather than the entire timestamp, so anything in the current hour would get filtered out.  I've changed it to use DateTime.IsInPreviousNMinutes() and it's picking up the recent files now.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard