Date.IsInPreviousNYears
This function checks if the provided date and time value (dateTime) falls within the number of years specified in the current system date and time. It should be noted that the function will return fal...
This function checks if the provided date and time value (dateTime) falls within the number of years specified in the current system date and time. It should be noted that the function will return false if the value falls within the current year.
Parameters:
- dateTime: A date, datetime, or datetimezone value to be analyzed.
- years: The number of years to compare against.
Check if the year preceding the current system time falls within the scope of the past two years. This can be achieved using the Power Query function MDate.IsInPreviousNYears, where the input is the date obtained by subtracting one year from the current system time, and the number of years to consider is set to 2. In this case, the output is true, indicating that the year before the current system time is indeed within the previous two years.