ErsinALACA
New Member
- Joined
- Mar 6, 2020
- Messages
- 31
- Office Version
- 2019
- Platform
- Windows
Hi; While browsing the Internet, I encountered a file with the following codes. Creating an Index; during grouping. Can we improve this process? I tried, I couldn't. Can we get a cumulative total for Nb Items (line by line)?
Thanks in advance.
VBA Code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Supplier", type text}, {"Item", type text}, {"Nb Item", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Supplier", Order.Ascending}, {"Nb Item", Order.Descending}}),
#"Group by Supplier" = Table.Group(#"Sorted Rows", {"Supplier"}, {{"Partition", each Table.AddIndexColumn(_, "Rank", 1,1), type table}}),
#"Expanded Partition" = Table.ExpandTableColumn(#"Group by Supplier", "Partition", {"Item", "Nb Item", "Rank"}, {"Item", "Nb Item", "Rank"})
in
#"Expanded Partition"
Thanks in advance.