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

Don'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.

Reply
lkshck
Helper III
Helper III

Add new Row to existing table with null Values

Hey,

I'm having a table from Azure Cost Management with 54 columns and I want to add a custom Row to the table with a credit value in the Cost column and a date value in the Date column. All other columns should contain a null value. Currently I tried it with the following:

= Table.InsertRows(#"Appended Query", 0, {[Date="01.07.2022 00:00:00", Cost="<CreditAmount>"]})

This leads to an error in this new Row for every column. Do I need to add every column name to this query and set them to null or is there any easy way to define null as a default value for all the other columns.

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@lkshck , Create a new table(enter data) with required column name and append it

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @lkshck ,

 

Please add the code.

 

    #"Insert Row" = let Names = Table.ColumnNames(#"Changed Type"), Count = List.Count(Names), mylist = List.Repeat({null}, Count)
                    in Table.InsertRows( #"Changed Type", 0, {Record.FromList(List.ReplaceRange(List.ReplaceRange(mylist,0,1,{"01.07.2022 00:00:00"}),3,1,{15}), Names)})

Names: return the names of all columns.
Count: returns the number of columns - 7
mylist: return a list with 7 null values.
Then the list values in position 0 and position 3 (modified as appropriate) are replaced with inserted values.

 

vkkfmsft_1-1657607114053.png

 

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.

amitchandak
Super User
Super User

@lkshck , Create a new table(enter data) with required column name and append it

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Do I need to create the new Table only with the Columns which need to be filled or does all Columns need to exist in the new one?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.