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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Till__
Helper I
Helper I

Replace null with 0 if Header contains specific part of string

I want to replace null with 0 for different columns if the Header has a specific part of a string as here "costs". For example for the headers with: costs 2020 xyz, costs 2021 zy, costs 1996 hscdf

 = Table.ReplaceValue(#"Entfernte Spalten",null,0,Replacer.ReplaceValue,{"costs 2020 "})

 = Table.ReplaceValue(#"Entfernte Spalten",null,0,Replacer.ReplaceValue,{"costs 2021"})

 = Table.ReplaceValue(#"Entfernte Spalten",null,0,Replacer.ReplaceValue,{"costs 1996 hscdf})

 

As I have quite a lot of these columns to change manually I want to change the null with 0 for all columns if the header contains "costs". 

 

Thank you for your help in advance! 

 

 

1 ACCEPTED SOLUTION
Till__
Helper I
Helper I

I found a solution myself 

= Table.ReplaceValue(#"Entfernte Spalten",null,0,Replacer.ReplaceValue,List.Select(Table.ColumnNames(#"Entfernte Spalten"), each Text.Contains(_, "one-time costs")))

View solution in original post

1 REPLY 1
Till__
Helper I
Helper I

I found a solution myself 

= Table.ReplaceValue(#"Entfernte Spalten",null,0,Replacer.ReplaceValue,List.Select(Table.ColumnNames(#"Entfernte Spalten"), each Text.Contains(_, "one-time costs")))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.