Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ceyzaguirre
Frequent Visitor

Problem expand Nested table Power Query

Hello, something very strange is happening to me, I have a filtered table in Power Query with a single record, I perform some simple transformations on this table and I am left with two columns (just for the purpose of being able to see the complete image) as shown in image 1, I merge this table with another table that also has a single record and 2 columns (only for the purpose of being able to see the complete image), expanding the table modifies the value of the "To_date" column, In reality several values ​​are changed in several columns, could it be a product problem?

 

This is my PBI Version: 2.129.1229.0 64-bit (mayo de 2024)

 

Ceyzaguirre_0-1717706434164.png

 

Ceyzaguirre_1-1717706445027.png

 

Thank's

2 REPLIES 2
Ceyzaguirre
Frequent Visitor

Hi @Anonymous 

Thank you for your help.

The data is in a sql express on my computer. This problem had not happened to me before, however, the same thing happened to a colleague. To solve the problem I had to perform the left join before the group by, in that case there were no problems when expanding the table. I refreshed all the data from power query and the problem persists, I also refreshed from PBI desktop and the problem persists. I attach the script used in case it is useful.

 

let
Source = Stock,
RemovedOtherColumns = Table.SelectColumns(Source,{"Material", "To_Date", "Closing_Stock", "ValA", "Closing_Value"}),
FilteredRows1 = Table.SelectRows(RemovedOtherColumns, each [Material] = 205404),
FilteredRows = Table.SelectRows(FilteredRows1, each ([Closing_Stock] <> 0)),
#"Changed Type" = Table.TransformColumnTypes(FilteredRows,{{"To_Date", type date}}),
RenamedColumns = Table.RenameColumns(#"Changed Type",{{"ValA", "Planta"}}),
SortedRows = Table.Sort(RenamedColumns,{{"Material", Order.Ascending}, {"Planta", Order.Ascending}, {"To_Date", Order.Descending}}),
GroupedRows = Table.Group(SortedRows, {"Material", "Planta"}, {{"Data", each _, type table [Material=nullable number, Closing_Stock=nullable number, ValA=nullable text, Closing_Value=nullable number, To_Date=nullable date]}}),
AddedTabletoRecord = Table.AddColumn(GroupedRows, "Custom", each Table.First([Data])),
RemovedOtherColumns1 = Table.SelectColumns(AddedTabletoRecord,{"Custom"}),
ExpandedCustom = Table.ExpandRecordColumn(RemovedOtherColumns1, "Custom", {"Material", "Closing_Stock", "Planta", "Closing_Value", "To_Date"}, {"Material", "Closing_Stock", "Planta", "Closing_Value", "To_Date"}),
ChangedType = Table.TransformColumnTypes(ExpandedCustom,{{"Material", Int64.Type}, {"Closing_Stock", type number}, {"Planta", type text}, {"Closing_Value", Int64.Type}, {"To_Date", type date}}),
MergedProducto = Table.NestedJoin(ChangedType, {"Material"}, Producto, {"Codigo_Material"}, "Producto", JoinKind.LeftOuter),
ExpandedProducto = Table.ExpandTableColumn(MergedProducto, "Producto", {"Net_weight", "Costo_Traslado_Planta"}, {"Net_weight", "Costo_Traslado_Planta"}),
InsertedCostoUnitario = Table.AddColumn(ExpandedProducto, "CostoUnitario", each [Closing_Value] / [Closing_Stock], type number),
InsertedCosto = Table.AddColumn(InsertedCostoUnitario, "Costo", each [CostoUnitario] + [Costo_Traslado_Planta], type number)
in
InsertedCosto

Anonymous
Not applicable

Hi @Ceyzaguirre 

 

I tested with the same version of PBI Desktop and didn't experience the same issue. May I know what data source are you using? Does this problem happen with other data sources? Have you tried Refreshing all preview in Power Query Editor?

vjingzhanmsft_0-1717738443716.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.