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
cosminc
Post Partisan
Post Partisan

replace error

Hi all,

i have a data base (excel) in which i need to replace errors with 0 - all base;

on future refreshments the data base will have new columns and i need now to set up this replacement for all base variable; otherwise for future columns the issue will remain.

Thanks!

Cosmin

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

I guess there is just a tiny "#" missing in step "Table_without_error": 

 

let
Source = Excel.Workbook(File.Contents("C:\Users\coscirnu\Desktop\lucru\Brand_Tracker\Sursa\All_Categories_All_Waves_Labels.xlsx"), null, true),
All_Categories_All_Waves_Labels_Sheet = Source{[Item="All_Categories_All_Waves_Labels",Kind="Sheet"]}[Data],
Table_without_error = Table.ReplaceErrorValues(#"All_Categories_All_Waves_Labels_Sheet", List.Transform(Table.ColumnNames("All_Categories_All_Waves_Labels_Sheet"), each {_, 0}))
in
Table_without_error

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

You can use the replace errors functionality of the Query Editor to replace errors with 0. For future columns, that's tricky, perhaps @ImkeF has a suggestion for that.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

ok thanks

now i have almost 1500 columns which farther there are unpivoted

an automatically solution would be wonderfull

ImkeF
Community Champion
Community Champion

Hi @cosminc ,

a dynamic solution would be to add a step with with formula:

 

Table.ReplaceErrorValues(<YourTableName>, List.Transform(Table.ColumnNames(<YourTableName>), each {_, 0}))

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi,

can you help me with the right syntax?

i miss something and don't khow what.

Thanks a lot!

Cosmin

 

ps: the columns are not yet put on text or number format

 

let
Source = Excel.Workbook(File.Contents("C:\Users\coscirnu\Desktop\lucru\Brand_Tracker\Sursa\All_Categories_All_Waves_Labels.xlsx"), null, true),
All_Categories_All_Waves_Labels_Sheet = Source{[Item="All_Categories_All_Waves_Labels",Kind="Sheet"]}[Data],
Table_without_error = Table.ReplaceErrorValues("All_Categories_All_Waves_Labels_Sheet", List.Transform(Table.ColumnNames("All_Categories_All_Waves_Labels_Sheet"), each {_, 0}))
in
Table_without_error

ImkeF
Community Champion
Community Champion

I guess there is just a tiny "#" missing in step "Table_without_error": 

 

let
Source = Excel.Workbook(File.Contents("C:\Users\coscirnu\Desktop\lucru\Brand_Tracker\Sursa\All_Categories_All_Waves_Labels.xlsx"), null, true),
All_Categories_All_Waves_Labels_Sheet = Source{[Item="All_Categories_All_Waves_Labels",Kind="Sheet"]}[Data],
Table_without_error = Table.ReplaceErrorValues(#"All_Categories_All_Waves_Labels_Sheet", List.Transform(Table.ColumnNames("All_Categories_All_Waves_Labels_Sheet"), each {_, 0}))
in
Table_without_error

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

thanks,

there was another one 

let
Source = Excel.Workbook(File.Contents("C:\Users\coscirnu\Desktop\lucru\Brand_Tracker\Sursa\All_Categories_All_Waves_Labels.xlsx"), null, true),
All_Categories_All_Waves_Labels_Sheet = Source{[Item="All_Categories_All_Waves_Labels",Kind="Sheet"]}[Data],
Table_without_error = Table.ReplaceErrorValues(#"All_Categories_All_Waves_Labels_Sheet", List.Transform(Table.ColumnNames(#"All_Categories_All_Waves_Labels_Sheet"), each {_, 0}))
in
Table_without_error

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.