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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Replace value on importing of data

I have a situation where my source data is dirty. There is a value that should be zero but has a value of non-zero. I would like to replace this with a 0 based on a condition in another field. I think this is rather straightforward but I'm not clear how to do this with the Power BI data query. Also, can this be done inline rather than with a calculated column or a new column?

 

What is the best way to do this? 

 

 

Note: We recognize that we need to fix the source. The process will take longer than trying to gear up the data for the short term. We are fixing the data as part of Warehouse but this is still a needed change that would be important to know.

8 REPLIES 8
nandic
Super User
Super User

Hi @Anonymous ,
There are several ways to replace values in Power Query:
1) right click on column, replace values. It is good for replacing fixed values (ie: replace null with 0)
2) add column > conditional column. This way you can make it more dynamic using rules (if then else statement). If you are satisfied with new column, you can remove old column, it will keep the new one.
3) if column is showing error as there are different data types in column, you can right click on column, replace errors

Hope this helps.

Cheers,
Nemanja

Anonymous
Not applicable

Hi @nandic 

 

So if do a new column from the old one, what happens when I reload again? Or is it part of a step 

 

1) Create a new column

2) Bring over the data in the new column with the condition applied

3) delete old column

 

Rinse and repeat?

When you refresh data everything will work fine as Power Query saves all the steps which are visible on the right part of the screen.

On the other hand, if you had calculated column outside of power query (created in dax) and you remove it, all columns that were using that column will return error.

parry2k
Super User
Super User

@Anonymous check this post on how to conditionally replace the value in power query

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I think I'm not thinking about this correctly. Let me rephrase this.

 

In two columns, one is called Broker the other is called Security Type we have a value in Amount that has 1000.

 

How can I make a conditional column that looks at two columns (sort of a WHERE clause that has Security Type and Broker criteria) that sets the amount = 0.

 

The examples I saw do a replacer but the conditional column doesn't have multiple conditions on it.

 

@parry2k  @nandic  Any thoughts?

 

 

@Anonymous , conditional column can have multiple conditions, looking at different columns.
Here is example where i randomly used 3 columns and based on criteria returned value from specific column or entered value.
* example is random, not real logic 🙂

conditional column.PNG

Anonymous
Not applicable

I think it would be best to show you:

These two fields:

Sec_typ_name = either Currency Forward or Currency

and bkr_name = Credit Suisse - High Touch

axwack_0-1596054004727.png

 

and if the Sec_name = 

axwack_1-1596054018525.png

 

then this column should be 0

axwack_2-1596054059903.png

 

 

 

@Anonymous also this link can be helpful.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors