Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
For adding one empty row to the "Sorted rows" intermediate result I have the following code:
Table.InsertRows(#"Sorted Rows", 0, {[RoutingCropGroupCode = "", RouteName = "", LineNumber = "", Percentage = "", Quantity = "", DisplaySequence = "", CheckUniqueness = "", CheckPercentage = "", CheckRCGRouteMaster = ""]})
However, when there will be a change in the source columns, the code is broken. How can I add the columns dynamically?
Probably it's something with Table.ColumnNames(#"Sorted Rows"), but this will only return the column names. How then to add the empty values?
Solved! Go to Solution.
Also this one.
This uses your Table.InsertRows method
= Table.InsertRows(#"Sorted Rows", 0,{Record.FromList(List.Repeat({""},Table.ColumnCount(#"Sorted Rows")),Table.ColumnNames(#"Sorted Rows"))})
ChatGPT told me to use this. It is simple and it works.
Table.Combine( { Table.FromRecords( { [ ] } ), NormalTable } )
Expression "Table.FromRecords( { [ ] } )" will return table with 1 row and zero columns (!!!). After union, no new columns will be added to "NormalTable" because they don't exist, but one row will be added. That one row will be filled with nulls, as it is normal behavior for Table.Combine function. Super clever.
Also this one.
This uses your Table.InsertRows method
= Table.InsertRows(#"Sorted Rows", 0,{Record.FromList(List.Repeat({""},Table.ColumnCount(#"Sorted Rows")),Table.ColumnNames(#"Sorted Rows"))})
Just to add that this won't create a truly empty row - it inserts "" and should instead use
List.Repeat(null)
Try this alternative
Table.Combine({ Table.FromColumns(List.Transform(List.Repeat({""},Table.ColumnCount(#"Sorted Rows")),each {_}),Table.ColumnNames(#"Sorted Rows")), #"Sorted Rows"})
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
20 | |
10 | |
10 | |
10 |