Forum Discussion
transform table
- 5 years ago
Hi pakovic ,
According to your needs, I did a test in power query, and the following results can be used as a reference:let Origen = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fVA9C8IwEP0rR+YKySWnrsVJqEZoFykdOhQUWhXs/8crNfXQmIwv795XXStnNT8DK9j5wyk/nsGoTKkmq5XfF0Baw9AzYpi1oBt6oxjQ6j62PZRt3z2hvFwfQ3cbgXWZY+XlJDOfUkyP0nL4N4gV4JIZBYj0KZKysExZB4qv8gLCQnIfFyjzJ4r5MDof2/9GsekobhqEIr1MdFBMq5E0FMW+s28nx+YF", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Description = _t, Euro = _t]), #"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"Description", type text}, {"Euro", Int64.Type}}), Custom1 = Table.SelectRows(#"Tipo cambiado",each Text.Start([Description],5)<>"TOTAL"), #"Added Custom" = Table.AddColumn(Custom1, "Customer", each if Text.Contains([Description], "COMPANY") then [Description] else null), #"Filled Down" = Table.FillDown(#"Added Custom",{"Customer"}), #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Euro] <> null)), Custom2 = Table.AddColumn(#"Filtered Rows", "Sales Shipment", each if Text.Contains([Description],"Sales Shipment") then [Description] else null), #"Filled Up" = Table.FillUp(Custom2,{"Sales Shipment"}), Custom3 = Table.SelectRows(#"Filled Up",each Text.Start([Description],5)<>"Total"), #"Reordered Columns" = Table.ReorderColumns(Custom3,{"Customer", "Sales Shipment", "Description", "Euro"}), #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Euro", "Item"}}), Custom4 = Table.TransformColumns(#"Renamed Columns",{"Sales Shipment",each Text.End(_,3)}) in Custom4
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi pakovic ,
According to your needs, I did a test in power query, and the following results can be used as a reference:
let
Origen = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fVA9C8IwEP0rR+YKySWnrsVJqEZoFykdOhQUWhXs/8crNfXQmIwv795XXStnNT8DK9j5wyk/nsGoTKkmq5XfF0Baw9AzYpi1oBt6oxjQ6j62PZRt3z2hvFwfQ3cbgXWZY+XlJDOfUkyP0nL4N4gV4JIZBYj0KZKysExZB4qv8gLCQnIfFyjzJ4r5MDof2/9GsekobhqEIr1MdFBMq5E0FMW+s28nx+YF", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Description = _t, Euro = _t]),
#"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"Description", type text}, {"Euro", Int64.Type}}),
Custom1 = Table.SelectRows(#"Tipo cambiado",each Text.Start([Description],5)<>"TOTAL"),
#"Added Custom" = Table.AddColumn(Custom1, "Customer", each if Text.Contains([Description], "COMPANY") then [Description] else null),
#"Filled Down" = Table.FillDown(#"Added Custom",{"Customer"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Euro] <> null)),
Custom2 = Table.AddColumn(#"Filtered Rows", "Sales Shipment", each if Text.Contains([Description],"Sales Shipment")
then [Description]
else null),
#"Filled Up" = Table.FillUp(Custom2,{"Sales Shipment"}),
Custom3 = Table.SelectRows(#"Filled Up",each Text.Start([Description],5)<>"Total"),
#"Reordered Columns" = Table.ReorderColumns(Custom3,{"Customer", "Sales Shipment", "Description", "Euro"}),
#"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Euro", "Item"}}),
Custom4 = Table.TransformColumns(#"Renamed Columns",{"Sales Shipment",each Text.End(_,3)})
in
Custom4
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- pakovic5 years agoHelper I
Wow! Thank you very much. It works very well !!