I am trying to build a fiscal calendar in Power Query to provide this calendar as a dataflow for other departments too. In the past, I have used a DAX Calendar but this has its limits for sharing the calendar, right? So, I already have the Date, Fiscal Year and ISO/ Fiscal week information, using this M-Script:
let
StartDate = #date (2009,1,1),
EndDate = #date (2024,12,31),
ListOfDates = List.Dates(StartDate, DurationDays, #duration(1, 0, 0, 0)),
DurationDays = Duration.Days (EndDate - StartDate) + 1,
TableOfDates = Table.FromList(ListOfDates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
DateColText = Table.RenameColumns(TableOfDates,{{"Column1", "Date"}}),
DateCol = Table.TransformColumnTypes(DateColText,{{"Date", type date}}),
WeekdayCol = Table.AddColumn(DateCol, "Weekday Number", each Date.DayOfWeek([Date], Day.Monday) + 1,Int64.Type),
#"Inserted Day Name" = Table.AddColumn(WeekdayCol, "Day Name", each Date.DayOfWeekName([Date]), type text),
IsoWeekYearCol = Table.AddColumn(#"Inserted Day Name", "Iso Week Year", each Date.Year(Date.AddDays([Date], 4-[Weekday Number])), Int64.Type),
IsoWeekNrCol = Table.AddColumn(IsoWeekYearCol, "Iso Week Nummer", each (Duration.Days(Date.AddDays([Date], 4-[Weekday Number]) - #date([Iso Week Year], 1 , 7 - Date.DayOfWeek(#date([Iso Week Year],1,4), Day.Monday)))/7)+1, Int64.Type),
IsoWeekdayExtCol = Table.AddColumn(IsoWeekNrCol, "Iso Weekday Extended", each Text.From([Iso Week Year]) & "-W" & Text.End("0" & Text.From([Iso Week Nummer]), 2) & "-"& Text.From([Weekday Number]))
in
IsoWeekdayExtCol
But how can I now add a column for the corresponding fiscal month and also a individual column for CurrentMonth and CurrentWeek.
How would you do that?