Hi @lagp78,
That’s a completely different type of calendar, but yes, you could merge on the Date column to incorporate elements from it.
Or you can extend this P13 calendar, there are several defaults you can choose from. You can find them on the “add column” tab, under “Date”. I’ve added a period index and offset, note that if “today” is not included in the date range the offset column will default to null.
let
P13 = (StartYear as number, EndYear as number) as table =>
let
//StartYear = 2018,
//EndYear = 2025,
ListPeriods = Table.ToColumns( Table.FromRecords( List.Generate(
()=> [i=1, start=#date(StartYear, 4, 1)],
each [start] < #date(EndYear, 4, 1),
each [i = [i]+1, start = if Number.Mod([i], 13)=0 then #date(Date.Year([start]), 4, 1) else if Number.Mod([i], 13)=1 then [
LastSaturday = #date(Date.Year([start]), 4, 30) - #duration(Date.DayOfWeek(#date(Date.Year([start]), 4, 30), Day.Saturday), 0, 0, 0),
Closest = if List.Contains( {4, 3}, 28 - Date.Day(LastSaturday)) then Date.AddDays(LastSaturday, 7 ) else LastSaturday
][Closest] else Date.AddDays([start], 28)]
))),
DateTable = Table.ExpandListColumn(Table.FromColumns( {
List.Transform( List.Zip({ListPeriods{1}, List.Transform( List.Skip( ListPeriods{1}, 1), each Date.AddDays(_, -1)) & {#date(EndYear, 3, 31)} }), each List.Dates(_{0}, Number.From(_{1}-_{0})+1, Duration.From(1))),
ListPeriods{1},
List.Transform( List.Skip( ListPeriods{1}, 1), each Date.AddDays(_, -1)) & {#date(EndYear, 3, 31)},
ListPeriods{0},
List.Transform( ListPeriods{0}, each Number.Mod(_-1, 13)+1)
}, type table [Date= {date}, Start=date, End=date, Period index=Int64.Type, Period=Int64.Type] ), "Date"),
Today = Date.From(DateTime.FixedLocalNow()),
currentDate = Table.SelectRows( DateTable, each [Date] = Today ){0},
addPeriodOffset = Table.AddColumn( DateTable, "Period Offset", each [Period index] - (try currentDate[Period index] otherwise null), Int64.Type)
in
addPeriodOffset
in
P13