let
    Source = Table.Combine({#"supermarket_sales 1", Sheet1}),
    #"Renamed Columns" = Table.RenameColumns(Source,{{"cogs", "cost of goods sold"}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Renamed Columns", "Date", "Date - Copy"),
    #"Reordered Columns" = Table.ReorderColumns(#"Duplicated Column",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Date - Copy", "Time", "Payment", "cost of goods sold", "gross margin percentage", "gross income", "Rating"}),
    #"Removed Duplicates" = Table.Distinct(#"Reordered Columns", {"Invoice ID"}),
    #"Removed Columns" = Table.RemoveColumns(#"Removed Duplicates",{"Time"}),
    #"Replaced Value" = Table.ReplaceValue(#"Removed Columns","A","Ahmedabad",Replacer.ReplaceText,{"Branch"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","B","Bangalore",Replacer.ReplaceText,{"Branch"}),
    #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","C","Chennai",Replacer.ReplaceText,{"Branch"}),
    #"Inserted Day" = Table.AddColumn(#"Replaced Value2", "Day", each Date.Day([Date]), Int64.Type),
    #"Reordered Columns1" = Table.ReorderColumns(#"Inserted Day",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Day", "Date - Copy", "Payment", "cost of goods sold", "gross margin percentage", "gross income", "Rating"}),
    #"Inserted Month" = Table.AddColumn(#"Reordered Columns1", "Month", each Date.Month([Date]), Int64.Type),
    #"Reordered Columns2" = Table.ReorderColumns(#"Inserted Month",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Day", "Month", "Date - Copy", "Payment", "cost of goods sold", "gross margin percentage", "gross income", "Rating"}),
    #"Inserted Year" = Table.AddColumn(#"Reordered Columns2", "Year", each Date.Year([Date]), Int64.Type),
    #"Reordered Columns3" = Table.ReorderColumns(#"Inserted Year",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Day", "Month", "Year", "Date - Copy", "Payment", "cost of goods sold", "gross margin percentage", "gross income", "Rating"}),
    #"Inserted Month Name" = Table.AddColumn(#"Reordered Columns3", "Month Name", each Date.MonthName([Date]), type text),
    #"Reordered Columns4" = Table.ReorderColumns(#"Inserted Month Name",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Day", "Month", "Month Name", "Year", "Date - Copy", "Payment", "cost of goods sold", "gross margin percentage", "gross income", "Rating"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Reordered Columns4",{"Month"}),
    #"Added Custom" = Table.AddColumn(#"Removed Columns1", "Price Before Tax", each [Quantity]*[Unit price]),
    #"Reordered Columns5" = Table.ReorderColumns(#"Added Custom",{"Invoice ID", "Branch", "City", "Customer type", "Gender", "Product line", "Unit price", "Quantity", "Tax 5%", "Total", "Date", "Day", "Month Name", "Year", "Date - Copy", "Payment", "cost of goods sold", "Price Before Tax", "gross margin percentage", "gross income", "Rating"}),
    #"Removed Columns2" = Table.RemoveColumns(#"Reordered Columns5",{"cost of goods sold"}),
    #"Trimmed Text" = Table.TransformColumns(Table.TransformColumnTypes(#"Removed Columns2", {{"Date", type text}}, "en-US"),{{"Date", Text.Trim, type text}}),
    #"Rounded Off" = Table.TransformColumns(#"Trimmed Text",{{"Unit price", each Number.Round(_, 2), type number}, {"Tax 5%", each Number.Round(_, 2), type number}, {"Total", each Number.Round(_, 2), type number}, {"Price Before Tax", each Number.Round(_, 2), type number}, {"gross margin percentage", each Number.Round(_, 2), type number}, {"gross income", each Number.Round(_, 2), type number}, {"Rating", each Number.Round(_, 2), type number}}),
    #"Removed Columns3" = Table.RemoveColumns(#"Rounded Off",{"Date - Copy"}),
    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Removed Columns3", {{"Date", type date}}, "en-US")
in
    #"Changed Type with Locale"