Power Query's M language provides a rich collection of Date functions. One of the functions offered by Power Query's M language is Date.IsInYearToDate function. This function will give True or False depending on whether date is within Year to Date range. Hence, if today's date is 28-Nov-22, then dates from 1-Jan-22 to 28-Nov-22 will be giving True while any date not falling within this date range will give False. Hence, 29-Nov-22 will give the result of False.
Date.IsInYearToDate is a great function and finds tremendous use in handling many business scenario where you are asked to present things like YTD Sales, YTD Cost, YTD Profit, YTD Attrition and so on.
But Power Query's M Language doesn't have Date.IsInQuarterToDate, Date.IsInMonthToDate and Date.IsInWeekToDate functions which also have tremendous business needs. So, how to answer questions like QTD Sales, MTD Attrition, WTD Enquiries
Let's make Date.IsInQuarterToDate, Date.IsInMonthToDate and Date.IsInWeekToDate functions in Power Query
Excel file used in this video can be downloaded from – https://1drv.ms/x/s!Akd5y6ruJhvhviXVyi65cpC6QeNv?e=XQNI2p