// Creation of a calendar from nothing
let
Source = List.Numbers( 42000, 4000),
// create a list of 5000 days as from day 41270 (27th Dec 2012)
// this goes until 4th Sept 2026
// at that time the start point should be changed or the calender should be made longer (5500 days or 6000 days)
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "dday"}}),
// now we have the list as calendar
Add.Calender.Month = Table.AddColumn(#"Renamed Columns", "MMnth", each Date.Month([dday])),
Add.Calendar.Year = Table.AddColumn(Add.Calender.Month, "yyear", each Date.Year([dday])),
//Create accounting month & year
Add.Temp1 = Table.AddColumn(Add.Calendar.Year, "temp1", each ([MMnth]+9+12)),
#"Added Custom3" = Table.AddColumn(Add.Temp1, "RoundDwn", each Number.RoundDown(([temp1])/12)),
#"Added Custom4" = Table.AddColumn(#"Added Custom3", "AccMonth.Fig", each [temp1]-12*[RoundDwn]),
#"Replaced Value" = Table.ReplaceValue(#"Added Custom4",0,12,Replacer.ReplaceValue,{"AccMonth.Fig"}),
#"Removed Columns1" = Table.RemoveColumns(#"Replaced Value",{"temp1", "RoundDwn"}),
//Create Acc Year
#"Added AccYear" = Table.AddColumn(#"Removed Columns1", "AccYear", each [yyear]+ (if [AccMonth.Fig]>9 then -1 else 0)),
#"Added AccMonth" = Table.AddColumn(#"Added AccYear", "AccMonth ", each Text.End(Number.ToText([AccMonth.Fig]+100),2),type text),
#"Removed Columns" = Table.RemoveColumns(#"Added AccMonth",{"AccMonth.Fig"}),
#"Changed ToText" = Table.TransformColumnTypes(#"Removed Columns",{{"MMnth", type text}, {"yyear", type text}, {"AccYear", type text}, {"AccMonth ", type text}}),
#"Added AccQuarter" = Table.AddColumn(#"Changed ToText", "AccQuarter", each Number.RoundDown((Number.FromText([#"AccMonth "])-1)/3)+1,type text),
#"Changed Type1" = Table.TransformColumnTypes(#"Added AccQuarter",{{"AccQuarter", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Acc Quarter", each Text.Combine({"Q-",[AccQuarter]}),type text),
#"Removed Columns2" = Table.RemoveColumns(#"Added Custom",{"AccQuarter"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns2", "AccMonth#", each [#"AccMonth "]),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1",{{"AccMonth#", Int64.Type}})
in
#"Changed Type2"