Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, I would like to ask, in PQ, is there any way I could replace the value based on columns' name?
| ID | Group | Cost 1 | Cost 2 | Price 1 | Price 2 |
| 1 | A | - | 0.8 | - | -0.11 |
| 2 | B | 0.4 | - | - | 0.23 |
| 3 | - | 0.5 | - | 0.6 | - |
| 4 | C | - | 0.4 | 0.1 | - |
| 5 | D | 0.6 | 0.2 | 0.54 | 0.57 |
Like in this case, I would like to replace "-" with 0, but only apply to columns' name started with "Cost" & "Price"
Appreciated if any solutions.
Solved! Go to Solution.
Hi @ngct1112
Table.ReplaceValue(yourPreviousStep,"-",0,Replacer.ReplaceValue, List.Select( Table.ColumnNames( yourPreviousStep), each Text.Contains(_,"Cost") or Text.Contains(_,"Price")))
Hi @ngct1112
Table.ReplaceValue(yourPreviousStep,"-",0,Replacer.ReplaceValue, List.Select( Table.ColumnNames( yourPreviousStep), each Text.Contains(_,"Cost") or Text.Contains(_,"Price")))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!