Date.IsInPreviousNMonths

This function checks if the specified datetime value dateTime falls within the previous number of months, based on the current date and time of the system. It will return false if the value is within ...

Syntax

Date.IsInPreviousNMonths(dateTime as any, months as number) as nullable logical

About

This function checks if the specified datetime value dateTime falls within the previous number of months, based on the current date and time of the system. It will return false if the value is within the current month. The parameters for this function are: - dateTime: The date, datetime, or datetimezone value to be checked. - months: The number of months to be considered for the evaluation.

Explanation

Verify if the month prior to the current system time falls within the last two months. Function Used Power Query MDate.IsInPreviousNMonths(Date.AddMonths(DateTime.FixedLocalNow(), -1), 2) Result true