Forum Discussion
Append Two Tables Not Merging Correctly
- 2 years ago
Hi ok_kpop
Instead of Appending the table, you should merge them.
- Click on Merge Table in Table A
- Highlight the column Date/Time hold the control button and highlight the Time column
- Choose Table B from the drop down
- Repeat the same as Table A. It's important to do it Dat/Time then Time in that order for merging reasons.
- Press ok
- Expand the column, but only expand teh Data B column.
This should give you the result you need.
Alternatively, you could load both tables as they are into the dataset. If you have a Date table and a Time Table you coul create a relationship with both of them. DateTable Date column one to many with the Date/Time column in both tables and the Time Table Time column one to many with the Time column in both tables
In a table visual, Add the Date from the Date Table and the Time from the Time Table then DATA Column and then DATA B Column
MQuery for Time Table
let Source = List.Times(#time(0,0,0),24*60,#duration(0,0,1,0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table", {{"Column1", "Time"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns", {{"Time", type time}}), #"Inserted Hour" = Table.AddColumn(#"Changed Type", "Hour", each Time.Hour([Time]), Int64.Type), #"Inserted Minute" = Table.AddColumn(#"Inserted Hour", "Minute", each Time.Minute([Time]), Int64.Type), #"Added Conditional Column" = Table.AddColumn(#"Inserted Minute", "AM/PM", each if [Hour] < 12 then "a.m." else "p.m."), #"Changed Type1" = Table.TransformColumnTypes(#"Added Conditional Column", {{"AM/PM", type text}}), #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type1", "Time", "Time - Copy"), #"Removed Columns" = Table.RemoveColumns(#"Duplicated Column", {"Time - Copy"}), #"Duplicated Column1" = Table.DuplicateColumn(#"Removed Columns", "Hour", "Hour - Copy"), #"Renamed Columns1" = Table.RenameColumns(#"Duplicated Column1", {{"Hour - Copy", "Hour label"}}), #"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns1", {{"Hour label", type text}}), #"Removed Columns1" = Table.RemoveColumns(#"Changed Type2", {"Hour label"}), #"Inserted Prefix" = Table.AddColumn(#"Removed Columns1", "Prefix", each "0" & Text.From([Hour], "en-NZ"), type text), #"Renamed Columns2" = Table.RenameColumns(#"Inserted Prefix", {{"Prefix", "Hour Label"}}), #"Extracted Last Characters" = Table.TransformColumns(#"Renamed Columns2", {{"Hour Label", each Text.End(_, 2), type text}}), #"Inserted Prefix1" = Table.AddColumn(#"Extracted Last Characters", "Prefix", each "0" & Text.From([Minute], "en-NZ"), type text), #"Renamed Columns3" = Table.RenameColumns(#"Inserted Prefix1", {{"Prefix", "Minute Label"}}), #"Extracted Last Characters1" = Table.TransformColumns(#"Renamed Columns3", {{"Minute Label", each Text.End(_, 2), type text}}), #"Inserted Modulo" = Table.AddColumn(#"Extracted Last Characters1", "Modulo", each Number.Mod([Hour], 12), type number), #"Renamed Columns6" = Table.RenameColumns(#"Inserted Modulo", {{"Modulo", "Hour Bin 12"}}), #"Inserted Integer-Division" = Table.AddColumn(#"Renamed Columns6", "Integer-Division", each Number.IntegerDivide([Hour], 8), Int64.Type), #"Renamed Columns7" = Table.RenameColumns(#"Inserted Integer-Division", {{"Integer-Division", "Hour Bin 8"}}), #"Inserted Integer-Division1" = Table.AddColumn(#"Renamed Columns7", "Integer-Division", each Number.IntegerDivide([Hour], 6), Int64.Type), #"Renamed Columns8" = Table.RenameColumns(#"Inserted Integer-Division1", {{"Integer-Division", "Hour Bin 6"}}), #"Inserted Integer-Division2" = Table.AddColumn(#"Renamed Columns8", "Integer-Division", each Number.IntegerDivide([Hour], 4), Int64.Type), #"Renamed Columns9" = Table.RenameColumns(#"Inserted Integer-Division2", {{"Integer-Division", "Hour Bin 4"}}), #"Inserted Integer-Division3" = Table.AddColumn(#"Renamed Columns9", "Integer-Division", each Number.IntegerDivide([Hour], 3), Int64.Type), #"Renamed Columns10" = Table.RenameColumns(#"Inserted Integer-Division3", {{"Integer-Division", "Hour Bin 3"}}), #"Inserted Integer-Division4" = Table.AddColumn(#"Renamed Columns10", "Integer-Division", each Number.IntegerDivide([Hour], 2), Int64.Type), #"Renamed Columns11" = Table.RenameColumns(#"Inserted Integer-Division4", {{"Integer-Division", "Hour Bin 2"}}), #"Inserted Integer-Division5" = Table.AddColumn(#"Renamed Columns11", "Integer-Division", each Number.IntegerDivide([Minute], 30), Int64.Type), #"Multiplied Column" = Table.TransformColumns(#"Inserted Integer-Division5", {{"Integer-Division", each _ * 30, type number}}), #"Renamed Columns12" = Table.RenameColumns(#"Multiplied Column", {{"Integer-Division", "Minute Bin 30"}}), #"Inserted Integer-Division6" = Table.AddColumn(#"Renamed Columns12", "Integer-Division", each Number.IntegerDivide([Minute], 15), Int64.Type), #"Multiplied Column1" = Table.TransformColumns(#"Inserted Integer-Division6", {{"Integer-Division", each _ * 15, type number}}), #"Renamed Columns13" = Table.RenameColumns(#"Multiplied Column1", {{"Integer-Division", "Minute Bin 15"}}), #"Inserted Integer-Division7" = Table.AddColumn(#"Renamed Columns13", "Integer-Division", each Number.IntegerDivide([Minute], 10), Int64.Type), #"Multiplied Column2" = Table.TransformColumns(#"Inserted Integer-Division7", {{"Integer-Division", each _ * 10, type number}}), #"Renamed Columns14" = Table.RenameColumns(#"Multiplied Column2", {{"Integer-Division", "Minute Bin 10"}}), #"Duplicated column" = Table.DuplicateColumn(#"Renamed Columns14", "Time", "TimeKey"), #"Changed column type" = Table.TransformColumnTypes(#"Duplicated column", {{"TimeKey", type text}}), #"Replaced value" = Table.ReplaceValue(#"Changed column type", ":", "", Replacer.ReplaceText, {"TimeKey"}) in #"Replaced value"MQuery for a Date Table
let // configurations start Today = Date.From(DateTime.LocalNow()), // today's date FromYear = Date.Year(DateTime.LocalNow()) -3, // set the start year of the date dimension. dates start from 1st of January of this year ToYear = Date.Year(DateTime.LocalNow()) +6, // set the end year of the date dimension. dates end at 31st of December of this year StartofFiscalYear = 7, // set the month number that is start of the financial year. example; if fiscal year start is July, value is 7 firstDayofWeek = Day.Monday, // set the week's start day, values: Day.Monday, Day, Sunday.... // configuration end FromDate = #date(FromYear,1,1), ToDate = #date(ToYear,12,31), Source = List.Dates( FromDate, Duration.Days(ToDate-FromDate)+1, #duration(1,0,0,0) ), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table", {{"Column1", "Date"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns", {{"Date", type date}}), #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Date]), Int64.Type), #"Inserted Start of Year" = Table.AddColumn(#"Inserted Year", "Start of Year", each Date.StartOfYear([Date]), type date), #"Inserted End of Year" = Table.AddColumn(#"Inserted Start of Year", "End of Year", each Date.EndOfYear([Date]), type date), #"Inserted Month" = Table.AddColumn(#"Inserted End of Year", "Month", each Date.Month([Date]), Int64.Type), #"Inserted Start of Month" = Table.AddColumn(#"Inserted Month", "Start of Month", each Date.StartOfMonth([Date]), type date), #"Inserted End of Month" = Table.AddColumn(#"Inserted Start of Month", "End of Month", each Date.EndOfMonth([Date]), type date), #"Inserted Days in Month" = Table.AddColumn(#"Inserted End of Month", "Days in Month", each Date.DaysInMonth([Date]), Int64.Type), #"Inserted Day" = Table.AddColumn(#"Inserted Days in Month", "Day", each Date.Day([Date]), Int64.Type), #"Inserted Day Name" = Table.AddColumn(#"Inserted Day", "Day Name", each Date.DayOfWeekName([Date]), type text), #"Inserted Day of Week" = Table.AddColumn(#"Inserted Day Name", "Day of Week", each Date.DayOfWeek([Date]), Int64.Type), #"Inserted Day of Year" = Table.AddColumn(#"Inserted Day of Week", "Day of Year", each Date.DayOfYear([Date]), Int64.Type), #"Inserted Month Name" = Table.AddColumn(#"Inserted Day of Year", "Month Name", each Date.MonthName([Date]), type text), #"Inserted Quarter" = Table.AddColumn(#"Inserted Month Name", "Quarter", each Date.QuarterOfYear([Date]), Int64.Type), #"Inserted Start of Quarter" = Table.AddColumn(#"Inserted Quarter", "Start of Quarter", each Date.StartOfQuarter([Date]), type date), #"Inserted End of Quarter" = Table.AddColumn(#"Inserted Start of Quarter", "End of Quarter", each Date.EndOfQuarter([Date]), type date), #"Inserted Week of Year" = Table.AddColumn(#"Inserted End of Quarter", "Week of Year", each Date.WeekOfYear([Date], firstDayofWeek), Int64.Type), #"Inserted Week of Month" = Table.AddColumn(#"Inserted Week of Year", "Week of Month", each Date.WeekOfMonth([Date], firstDayofWeek), Int64.Type), #"Inserted Start of Week" = Table.AddColumn(#"Inserted Week of Month", "Start of Week", each Date.StartOfWeek([Date], firstDayofWeek), type date), #"Inserted End of Week" = Table.AddColumn(#"Inserted Start of Week", "End of Week", each Date.EndOfWeek([Date], firstDayofWeek), type date), FiscalMonthBaseIndex = 13-StartofFiscalYear, adjustedFiscalMonthBaseIndex = if(FiscalMonthBaseIndex>=12 or FiscalMonthBaseIndex<0) then 0 else FiscalMonthBaseIndex, #"Added Custom" = Table.AddColumn(#"Inserted End of Week", "FiscalBaseDate", each Date.AddMonths([Date], adjustedFiscalMonthBaseIndex)), #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom", {{"FiscalBaseDate", type date}}), #"Inserted Year1" = Table.AddColumn(#"Changed Type1", "Year.1", each Date.Year([FiscalBaseDate]), Int64.Type), #"Renamed Columns1" = Table.RenameColumns(#"Inserted Year1", {{"Year.1", "Fiscal Year"}}), #"Inserted Quarter1" = Table.AddColumn(#"Renamed Columns1", "Quarter.1", each Date.QuarterOfYear([FiscalBaseDate]), Int64.Type), #"Renamed Columns2" = Table.RenameColumns(#"Inserted Quarter1", {{"Quarter.1", "Fiscal Quarter"}}), #"Inserted Month1" = Table.AddColumn(#"Renamed Columns2", "Month.1", each Date.Month([FiscalBaseDate]), Int64.Type), #"Renamed Columns3" = Table.RenameColumns(#"Inserted Month1", {{"Month.1", "Fiscal Month"}}), #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns3", {"FiscalBaseDate"}), #"Inserted Age" = Table.AddColumn(#"Removed Columns", "Age", each [Date] - Today, type duration), #"Extracted Days" = Table.TransformColumns(#"Inserted Age",{{"Age", Duration.Days, Int64.Type}}), #"Renamed Columns4" = Table.RenameColumns(#"Extracted Days", {{"Age", "Day Offset"}}), #"Added Custom1" = Table.AddColumn(#"Renamed Columns4", "Month Offset", each (([Year]-Date.Year(Today))*12) +([Month]-Date.Month(Today))), #"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1", {{"Month Offset", Int64.Type}}), #"Added Custom2" = Table.AddColumn(#"Changed Type2", "Year Offset", each [Year]-Date.Year(Today)), #"Changed Type3" = Table.TransformColumnTypes(#"Added Custom2", {{"Year Offset", Int64.Type}}), #"Added Custom3" = Table.AddColumn(#"Changed Type3", "Quarter Offset", each (([Year]-Date.Year(Today))*4) +([Quarter]-Date.QuarterOfYear(Today))), #"Changed Type4" = Table.TransformColumnTypes(#"Added Custom3", {{"Quarter Offset", Int64.Type}}), #"Added custom" = Table.AddColumn(#"Changed Type4", "Datekey", each Date.ToText(Date.From([Date]), "yyyyMMdd")), #"Changed column type" = Table.TransformColumnTypes(#"Added custom", {{"Datekey", Int64.Type}}), #"Added custom 1" = Table.AddColumn(#"Changed column type", "Month-Text", each Text.PadStart( Text.From([Month]), 2, "0")), #"Changed column type 1" = Table.TransformColumnTypes(#"Added custom 1", {{"Month-Text", type text}}), #"Inserted merged column" = Table.AddColumn(#"Changed column type 1", "Month-Year", each Text.Combine({[#"Month-Text"], Text.From([Year])}, "-"), type text), #"Extracted first characters" = Table.TransformColumns(#"Inserted merged column", {{"Month Name", each Text.Start(_, 3), type text}}), #"Extracted first characters 1" = Table.TransformColumns(#"Extracted first characters", {{"Day Name", each Text.Start(_, 3), type text}}) in #"Extracted first characters 1"Thanks
Joe
If this post helps, then please Accept it as the solution
Hi ok_kpop
Instead of Appending the table, you should merge them.
- Click on Merge Table in Table A
- Highlight the column Date/Time hold the control button and highlight the Time column
- Choose Table B from the drop down
- Repeat the same as Table A. It's important to do it Dat/Time then Time in that order for merging reasons.
- Press ok
- Expand the column, but only expand teh Data B column.
This should give you the result you need.
Alternatively, you could load both tables as they are into the dataset. If you have a Date table and a Time Table you coul create a relationship with both of them. DateTable Date column one to many with the Date/Time column in both tables and the Time Table Time column one to many with the Time column in both tables
In a table visual, Add the Date from the Date Table and the Time from the Time Table then DATA Column and then DATA B Column
MQuery for Time Table
let
Source = List.Times(#time(0,0,0),24*60,#duration(0,0,1,0)),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table", {{"Column1", "Time"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns", {{"Time", type time}}),
#"Inserted Hour" = Table.AddColumn(#"Changed Type", "Hour", each Time.Hour([Time]), Int64.Type),
#"Inserted Minute" = Table.AddColumn(#"Inserted Hour", "Minute", each Time.Minute([Time]), Int64.Type),
#"Added Conditional Column" = Table.AddColumn(#"Inserted Minute", "AM/PM", each if [Hour] < 12 then "a.m." else "p.m."),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Conditional Column", {{"AM/PM", type text}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type1", "Time", "Time - Copy"),
#"Removed Columns" = Table.RemoveColumns(#"Duplicated Column", {"Time - Copy"}),
#"Duplicated Column1" = Table.DuplicateColumn(#"Removed Columns", "Hour", "Hour - Copy"),
#"Renamed Columns1" = Table.RenameColumns(#"Duplicated Column1", {{"Hour - Copy", "Hour label"}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns1", {{"Hour label", type text}}),
#"Removed Columns1" = Table.RemoveColumns(#"Changed Type2", {"Hour label"}),
#"Inserted Prefix" = Table.AddColumn(#"Removed Columns1", "Prefix", each "0" & Text.From([Hour], "en-NZ"), type text),
#"Renamed Columns2" = Table.RenameColumns(#"Inserted Prefix", {{"Prefix", "Hour Label"}}),
#"Extracted Last Characters" = Table.TransformColumns(#"Renamed Columns2", {{"Hour Label", each Text.End(_, 2), type text}}),
#"Inserted Prefix1" = Table.AddColumn(#"Extracted Last Characters", "Prefix", each "0" & Text.From([Minute], "en-NZ"), type text),
#"Renamed Columns3" = Table.RenameColumns(#"Inserted Prefix1", {{"Prefix", "Minute Label"}}),
#"Extracted Last Characters1" = Table.TransformColumns(#"Renamed Columns3", {{"Minute Label", each Text.End(_, 2), type text}}),
#"Inserted Modulo" = Table.AddColumn(#"Extracted Last Characters1", "Modulo", each Number.Mod([Hour], 12), type number),
#"Renamed Columns6" = Table.RenameColumns(#"Inserted Modulo", {{"Modulo", "Hour Bin 12"}}),
#"Inserted Integer-Division" = Table.AddColumn(#"Renamed Columns6", "Integer-Division", each Number.IntegerDivide([Hour], 8), Int64.Type),
#"Renamed Columns7" = Table.RenameColumns(#"Inserted Integer-Division", {{"Integer-Division", "Hour Bin 8"}}),
#"Inserted Integer-Division1" = Table.AddColumn(#"Renamed Columns7", "Integer-Division", each Number.IntegerDivide([Hour], 6), Int64.Type),
#"Renamed Columns8" = Table.RenameColumns(#"Inserted Integer-Division1", {{"Integer-Division", "Hour Bin 6"}}),
#"Inserted Integer-Division2" = Table.AddColumn(#"Renamed Columns8", "Integer-Division", each Number.IntegerDivide([Hour], 4), Int64.Type),
#"Renamed Columns9" = Table.RenameColumns(#"Inserted Integer-Division2", {{"Integer-Division", "Hour Bin 4"}}),
#"Inserted Integer-Division3" = Table.AddColumn(#"Renamed Columns9", "Integer-Division", each Number.IntegerDivide([Hour], 3), Int64.Type),
#"Renamed Columns10" = Table.RenameColumns(#"Inserted Integer-Division3", {{"Integer-Division", "Hour Bin 3"}}),
#"Inserted Integer-Division4" = Table.AddColumn(#"Renamed Columns10", "Integer-Division", each Number.IntegerDivide([Hour], 2), Int64.Type),
#"Renamed Columns11" = Table.RenameColumns(#"Inserted Integer-Division4", {{"Integer-Division", "Hour Bin 2"}}),
#"Inserted Integer-Division5" = Table.AddColumn(#"Renamed Columns11", "Integer-Division", each Number.IntegerDivide([Minute], 30), Int64.Type),
#"Multiplied Column" = Table.TransformColumns(#"Inserted Integer-Division5", {{"Integer-Division", each _ * 30, type number}}),
#"Renamed Columns12" = Table.RenameColumns(#"Multiplied Column", {{"Integer-Division", "Minute Bin 30"}}),
#"Inserted Integer-Division6" = Table.AddColumn(#"Renamed Columns12", "Integer-Division", each Number.IntegerDivide([Minute], 15), Int64.Type),
#"Multiplied Column1" = Table.TransformColumns(#"Inserted Integer-Division6", {{"Integer-Division", each _ * 15, type number}}),
#"Renamed Columns13" = Table.RenameColumns(#"Multiplied Column1", {{"Integer-Division", "Minute Bin 15"}}),
#"Inserted Integer-Division7" = Table.AddColumn(#"Renamed Columns13", "Integer-Division", each Number.IntegerDivide([Minute], 10), Int64.Type),
#"Multiplied Column2" = Table.TransformColumns(#"Inserted Integer-Division7", {{"Integer-Division", each _ * 10, type number}}),
#"Renamed Columns14" = Table.RenameColumns(#"Multiplied Column2", {{"Integer-Division", "Minute Bin 10"}}),
#"Duplicated column" = Table.DuplicateColumn(#"Renamed Columns14", "Time", "TimeKey"),
#"Changed column type" = Table.TransformColumnTypes(#"Duplicated column", {{"TimeKey", type text}}),
#"Replaced value" = Table.ReplaceValue(#"Changed column type", ":", "", Replacer.ReplaceText, {"TimeKey"})
in
#"Replaced value"
MQuery for a Date Table
let
// configurations start
Today = Date.From(DateTime.LocalNow()),
// today's date
FromYear = Date.Year(DateTime.LocalNow()) -3,
// set the start year of the date dimension. dates start from 1st of January of this year
ToYear = Date.Year(DateTime.LocalNow()) +6,
// set the end year of the date dimension. dates end at 31st of December of this year
StartofFiscalYear = 7,
// set the month number that is start of the financial year. example; if fiscal year start is July, value is 7
firstDayofWeek = Day.Monday,
// set the week's start day, values: Day.Monday, Day, Sunday....
// configuration end
FromDate = #date(FromYear,1,1),
ToDate = #date(ToYear,12,31),
Source = List.Dates(
FromDate,
Duration.Days(ToDate-FromDate)+1,
#duration(1,0,0,0)
),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table", {{"Column1", "Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns", {{"Date", type date}}),
#"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Date]), Int64.Type),
#"Inserted Start of Year" = Table.AddColumn(#"Inserted Year", "Start of Year", each Date.StartOfYear([Date]), type date),
#"Inserted End of Year" = Table.AddColumn(#"Inserted Start of Year", "End of Year", each Date.EndOfYear([Date]), type date),
#"Inserted Month" = Table.AddColumn(#"Inserted End of Year", "Month", each Date.Month([Date]), Int64.Type),
#"Inserted Start of Month" = Table.AddColumn(#"Inserted Month", "Start of Month", each Date.StartOfMonth([Date]), type date),
#"Inserted End of Month" = Table.AddColumn(#"Inserted Start of Month", "End of Month", each Date.EndOfMonth([Date]), type date),
#"Inserted Days in Month" = Table.AddColumn(#"Inserted End of Month", "Days in Month", each Date.DaysInMonth([Date]), Int64.Type),
#"Inserted Day" = Table.AddColumn(#"Inserted Days in Month", "Day", each Date.Day([Date]), Int64.Type),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day", "Day Name", each Date.DayOfWeekName([Date]), type text),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Day Name", "Day of Week", each Date.DayOfWeek([Date]), Int64.Type),
#"Inserted Day of Year" = Table.AddColumn(#"Inserted Day of Week", "Day of Year", each Date.DayOfYear([Date]), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Day of Year", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Quarter" = Table.AddColumn(#"Inserted Month Name", "Quarter", each Date.QuarterOfYear([Date]), Int64.Type),
#"Inserted Start of Quarter" = Table.AddColumn(#"Inserted Quarter", "Start of Quarter", each Date.StartOfQuarter([Date]), type date),
#"Inserted End of Quarter" = Table.AddColumn(#"Inserted Start of Quarter", "End of Quarter", each Date.EndOfQuarter([Date]), type date),
#"Inserted Week of Year" = Table.AddColumn(#"Inserted End of Quarter", "Week of Year", each Date.WeekOfYear([Date], firstDayofWeek), Int64.Type),
#"Inserted Week of Month" = Table.AddColumn(#"Inserted Week of Year", "Week of Month", each Date.WeekOfMonth([Date], firstDayofWeek), Int64.Type),
#"Inserted Start of Week" = Table.AddColumn(#"Inserted Week of Month", "Start of Week", each Date.StartOfWeek([Date], firstDayofWeek), type date),
#"Inserted End of Week" = Table.AddColumn(#"Inserted Start of Week", "End of Week", each Date.EndOfWeek([Date], firstDayofWeek), type date),
FiscalMonthBaseIndex = 13-StartofFiscalYear,
adjustedFiscalMonthBaseIndex = if(FiscalMonthBaseIndex>=12 or FiscalMonthBaseIndex<0) then 0 else FiscalMonthBaseIndex,
#"Added Custom" = Table.AddColumn(#"Inserted End of Week", "FiscalBaseDate", each Date.AddMonths([Date], adjustedFiscalMonthBaseIndex)),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom", {{"FiscalBaseDate", type date}}),
#"Inserted Year1" = Table.AddColumn(#"Changed Type1", "Year.1", each Date.Year([FiscalBaseDate]), Int64.Type),
#"Renamed Columns1" = Table.RenameColumns(#"Inserted Year1", {{"Year.1", "Fiscal Year"}}),
#"Inserted Quarter1" = Table.AddColumn(#"Renamed Columns1", "Quarter.1", each Date.QuarterOfYear([FiscalBaseDate]), Int64.Type),
#"Renamed Columns2" = Table.RenameColumns(#"Inserted Quarter1", {{"Quarter.1", "Fiscal Quarter"}}),
#"Inserted Month1" = Table.AddColumn(#"Renamed Columns2", "Month.1", each Date.Month([FiscalBaseDate]), Int64.Type),
#"Renamed Columns3" = Table.RenameColumns(#"Inserted Month1", {{"Month.1", "Fiscal Month"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns3", {"FiscalBaseDate"}),
#"Inserted Age" = Table.AddColumn(#"Removed Columns", "Age", each [Date] - Today, type duration),
#"Extracted Days" = Table.TransformColumns(#"Inserted Age",{{"Age", Duration.Days, Int64.Type}}),
#"Renamed Columns4" = Table.RenameColumns(#"Extracted Days", {{"Age", "Day Offset"}}),
#"Added Custom1" = Table.AddColumn(#"Renamed Columns4", "Month Offset", each (([Year]-Date.Year(Today))*12)
+([Month]-Date.Month(Today))),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1", {{"Month Offset", Int64.Type}}),
#"Added Custom2" = Table.AddColumn(#"Changed Type2", "Year Offset", each [Year]-Date.Year(Today)),
#"Changed Type3" = Table.TransformColumnTypes(#"Added Custom2", {{"Year Offset", Int64.Type}}),
#"Added Custom3" = Table.AddColumn(#"Changed Type3", "Quarter Offset", each (([Year]-Date.Year(Today))*4)
+([Quarter]-Date.QuarterOfYear(Today))),
#"Changed Type4" = Table.TransformColumnTypes(#"Added Custom3", {{"Quarter Offset", Int64.Type}}),
#"Added custom" = Table.AddColumn(#"Changed Type4", "Datekey", each Date.ToText(Date.From([Date]), "yyyyMMdd")),
#"Changed column type" = Table.TransformColumnTypes(#"Added custom", {{"Datekey", Int64.Type}}),
#"Added custom 1" = Table.AddColumn(#"Changed column type", "Month-Text", each Text.PadStart( Text.From([Month]), 2, "0")),
#"Changed column type 1" = Table.TransformColumnTypes(#"Added custom 1", {{"Month-Text", type text}}),
#"Inserted merged column" = Table.AddColumn(#"Changed column type 1", "Month-Year", each Text.Combine({[#"Month-Text"], Text.From([Year])}, "-"), type text),
#"Extracted first characters" = Table.TransformColumns(#"Inserted merged column", {{"Month Name", each Text.Start(_, 3), type text}}),
#"Extracted first characters 1" = Table.TransformColumns(#"Extracted first characters", {{"Day Name", each Text.Start(_, 3), type text}})
in
#"Extracted first characters 1"Thanks
Joe
If this post helps, then please Accept it as the solution