let
Source = Excel.Workbook(File.Contents("C:\Users\Vitali.Burla\OneDrive - Adastra, s.r.o\Documents\Power BI Files - Personal\challenge 6.xlsx"), null, true),
Data_Table = Source{[Item="Data",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data_Table,{{"InvoiceID", Int64.Type}, {"ItemID", type any}, {"Quantity", type any}, {"Price", type any}}),
#"Split Column by Delimiter" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"ItemID", type text}}, "en-GB"), "ItemID", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), {"ItemID.1", "ItemID.2", "ItemID.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"ItemID.1", Int64.Type}, {"ItemID.2", Int64.Type}, {"ItemID.3", Int64.Type}}),
#"Split Column by Delimiter1" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type1", {{"Quantity", type text}}, "en-GB"), "Quantity", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), {"Quantity.1", "Quantity.2", "Quantity.3"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Quantity.1", Int64.Type}, {"Quantity.2", Int64.Type}, {"Quantity.3", Int64.Type}, {"Price", type text}}),
#"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type2", "Price", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), {"Price.1", "Price.2", "Price.3"}),
#"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"Price.1", type number}, {"Price.2", type number}, {"Price.3", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type3", {"InvoiceID", "Quantity.1", "Quantity.2", "Quantity.3", "Price.1", "Price.2", "Price.3"}, "Attribute", "Value"),
#"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Value", "Item"}}),
#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"InvoiceID", "Item", "Quantity.1", "Quantity.2", "Quantity.3", "Price.1", "Price.2", "Price.3", "Attribute"}),
#"Unpivoted Columns1" = Table.UnpivotOtherColumns(#"Reordered Columns", {"InvoiceID", "Item", "Price.1", "Price.2", "Price.3", "Attribute"}, "Attribute.1", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Columns1",{{"Value", "Quantity"}}),
#"Reordered Columns1" = Table.ReorderColumns(#"Renamed Columns1",{"InvoiceID", "Item", "Quantity", "Price.1", "Price.2", "Price.3", "Attribute", "Attribute.1"}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Reordered Columns1", {"Price.1", "Price.2", "Price.3"}, "Attribute.2", "Value"),
#"Extracted Last Characters" = Table.TransformColumns(#"Unpivoted Only Selected Columns", {{"Attribute", each Text.End(_, 1), type text}}),
#"Extracted Last Characters1" = Table.TransformColumns(#"Extracted Last Characters", {{"Attribute.1", each Text.End(_, 1), type text}}),
#"Extracted Last Characters2" = Table.TransformColumns(#"Extracted Last Characters1", {{"Attribute.2", each Text.End(_, 1), type text}}),
#"Added Custom" = Table.AddColumn(#"Extracted Last Characters2", "Keep1", each ([Attribute]=[Attribute.1])),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Keep2", each ([Attribute.1]=[Attribute.2])),
#"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Keep1] = true) and ([Keep2] = true)),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"InvoiceID", "Item", "Quantity", "Value"})
in
#"Removed Other Columns"