Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone, thank you very much for reading my post. I am trying to transform this table.
I have a table with data that looks like this:
Is it possible to transform the table so that it is displayed like this?
attached pbix file in case someone could help me.
https://www.dropbox.com/s/2dmy8303ob6stqb/example.pbix?dl=0
thank you all in advance.
Solved! Go to Solution.
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.
Wow! Thank you very much. It works very well !!
@pakovic , refer if this blog can help you
https://www.thebiccountant.com/2015/08/12/how-to-pivot-multiple-measurescolumns-in-power-query/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
99 | |
81 | |
77 | |
66 |
User | Count |
---|---|
134 | |
108 | |
104 | |
83 | |
73 |