Date.IsInPreviousNDays Function in Power Query

The Date.IsInPreviousNDays function indicates whether the given datetime value occurs during the previous number of days, as determined by the current date and time on the system.

Syntax

Date.IsInPreviousNDays(dateTime as any, days as number) as nullable logical

The function has the following parameters:

Returns:

Example: Let’s assume the current date is 3 April 2025.

Power Query M

let
    Source = Date.IsInPreviousNDays(#date(2025, 4, 2), 3)
in
    Source  

The output of the above code is true.

Note: • The function excludes the current day and only considers full past days.
• Useful for dynamic reports that filter records from recent days