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.
Good as they are?
I need to separate the values according to their type (VEN, CAM or DEV) each row has one of these values. what I need to achieve is to be able to break down the 3 values into different columns.
Any idea of how I can do it?
Best regards.
Hi @Syndicate_Admin ,
What data do you want to populate with when you convert column [Tipo] values to different columns? Assuming we use the Value column,
then please try the following code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jc6xDsIwDATQf/FcS+dzEtoRQUcYu1T5/9/AAYUsGbrcWfKT5fMUWYRAWr9NqCtvMRdGHPs7MgMeZVKXi7y0becbPHVtytxmi3juR2RyQ5QPDXZNtSlOAxOz04/7a+g809Q//n29brl9WaTWDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ComprobanteAsociado = _t, ID = _t, Facha = _t, Vendedor_ID = _t, Tipo = _t, Product_ID = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ComprobanteAsociado", type text}, {"ID", Int64.Type}, {"Facha", type date}, {"Vendedor_ID", Int64.Type}, {"Tipo", type text}, {"Product_ID", Int64.Type}, {"Value", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Tipo"}, {{"all", each _, type table [ComprobanteAsociado=nullable text, ID=nullable number, Facha=nullable date, Vendedor_ID=nullable number, Tipo=nullable text, Product_ID=nullable number, Value=nullable number]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddColumn([all], "NewColumn", each Record.FromList({[Value]},{[Tipo]}))),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"ComprobanteAsociado", "ID", "Facha", "Vendedor_ID", "Tipo", "Product_ID", "Value", "NewColumn"}, {"ComprobanteAsociado", "ID", "Facha", "Vendedor_ID", "Tipo", "Product_ID", "Value", "NewColumn"}),
#"Expanded NewColumn" = Table.ExpandRecordColumn(#"Expanded Custom", "NewColumn", {"VEN","DEV","CAM"}, {"VEN","DEV","CAM"})
in
#"Expanded NewColumn"
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Syndicate_Admin , You can create new column like
ven Importe = if([Type] ="VEN" , [Importe], blank())
you can create new columns in the same manner
Also, you can consider pivot
https://radacad.com/pivot-and-unpivot-with-power-bi
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 |
---|---|
105 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
137 | |
105 | |
104 | |
80 | |
63 |