Bạn sử dụng Power query biến đổi về dữ liệu chuẩn:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Duplicated Column" = Table.DuplicateColumn(Source, "SP", "Date"),
#"Split Column by Positions" = Table.SplitColumn(#"Duplicated Column", "Date", Splitter.SplitTextByPositions({10, 19})),
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Positions",{"Date.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Date.1", type date}}),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type", {{"Date.1", null}}),
#"Filled Down" = Table.FillDown(#"Replaced Errors",{"ID", "Date.1"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([SL] <> null and [SL] <> "Ban Hang Luu Dong")),
#"Changed Type1" = Table.TransformColumnTypes(#"Filtered Rows",{{"ID", type number}, {"SP", type text}, {"SL", type number}, {"Gia", type number}, {"Thanh tien", type number}})
in
#"Changed Type1"
Sau đó nạp vô Data Model để tính hoặc cho ra sheet để Pivot table cũng được:
Row Labels | Số lượng | Thành tiền |
APOLO | 50 | 2,700,000 |
Bong tich dien YQ802 | 51 | 3,570,000 |
Bong tich dien YQV212 | 52 | 5,665,000 |
Choa DD 9811 | 43 | 2,580,000 |
Choa DD A16 Yen quan | 32 | 3,520,000 |
Choa DD A18 Yen quan | 43 | 6,020,000 |
Choa DD A29 Yen quan | 46 | 9,660,000 |
Choa DD K25 | 26 | 5,980,000 |
Choa DD ML3 | 14 | 1,190,000 |
Den Led 036RD | 16 | 1,056,000 |
Den sac DP 7048 | 23 | 2,875,000 |
Den sac DP 7165 | 18 | 3,150,000 |
Den sac honda 1620 led | 8 | 2,120,000 |
Keo chong tham 10F | 17 | 850,000 |
Keo chong tham 5F | 42 | 1,176,000 |
Keo MPE lon | 18 | 846,000 |
Keo Nano nho | 9 | 270,000 |
ngu 3W | 135 | 1,080,000 |
ngu kieu | 394 | 4,728,000 |
O 2 lo Sunny | 20 | 190,000 |
Phit cam chiu tai Sunny | 60 | 372,000 |
Phit cam Sunny | 50 | 150,000 |
Pin 4316 | 95 | 4,370,000 |
Pin 9035 | 65 | 2,990,000 |
Pin 9121 | 123 | 2,367,000 |
Pin 9970(4110) | 70 | 2,450,000 |
pin dai con o | 57 | 3,249,000 |
pin tieu | 19 | 1,140,000 |
vot Mellin | 45 | 2,790,000 |
Vot RD 02 | 33 | 3,135,000 |
Vot RD 03 | 15 | 1,425,000 |
Grand Total | 1689 | 83,664,000 |