Forum Discussion
Custom month end date - second to last Friday
- 3 years ago
=let fx=(dt)=>Date.AddDays(dt,-List.Select({7..14},each Date.DayOfWeek(Date.AddDays(dt,-_))=4){0}),a=Date.EndOfMonth([Date]),b=fx(a) in if [Date]>b then fx(Date.EndOfMonth(Date.AddMonths(a,1))) else b
=let fx=(dt)=>Date.AddDays(dt,-List.Select({7..14},each Date.DayOfWeek(Date.AddDays(dt,-_))=4){0}),a=Date.EndOfMonth([Date]),b=fx(a) in if [Date]>b then fx(Date.EndOfMonth(Date.AddMonths(a,1))) else b
Hi! Sorry will be asking in this thread. Need you help similiar to this.
I want to add a custom column based on my [Date] column.
The custom column should be Last Friday of the Month, or if the [Date falls] after Last Friday of the Month, it will fall under Last Friday of Next Month.
Sample:
26-Nov-2024 will fall under 29-Nov-2024
30-Nov-2024 will fall under 27-Dec-2024
30-Dec-2024 will fall under 31-Jan-2025
Thank you in advance!