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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Confusedsigh
New Member

How do I replace the value in just one cell, please?

I want to replace the value Null to a certain number - in one cell. The problem is when I click on Replace Value, it will replace ...all... the Null values in that column with this number.

How can I replace the value in just one cell, please?

2 ACCEPTED SOLUTIONS
ImkeF
Super User
Super User

Hi @Confusedsigh ,
if the criteria that determines which row your value to be replaced sits in is called "Column3" and the condition is that the value is equal to 1 and you want to replace values in "Column2", then you could use this syntax:

= Table.ReplaceValue(#"Changed Type", null, each if [Column3] = 1 then "x" else [Column2], Replacer.ReplaceValue,{"Column2"})

Just do a full replace with the UI and then tweak the red part of the formula.
For more information around this technique, please check my article here: Table.TransformColumns - alternative in PowerBI and PowerQuery in Excel (thebiccountant.com)

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

ImkeF
Super User
Super User

Hi @Confusedsigh ,
no, that is what the condition is doing:
each if [Column3] = 1 then "x" else [Column2]
it will only replace the null values in Column2 if in another column ("Column3") the condition is met.
How are you going to determine which is the null value to be replaced in your case?

 

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

3 REPLIES 3
ImkeF
Super User
Super User

Hi @Confusedsigh ,
no, that is what the condition is doing:
each if [Column3] = 1 then "x" else [Column2]
it will only replace the null values in Column2 if in another column ("Column3") the condition is met.
How are you going to determine which is the null value to be replaced in your case?

 

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

ImkeF
Super User
Super User

Hi @Confusedsigh ,
if the criteria that determines which row your value to be replaced sits in is called "Column3" and the condition is that the value is equal to 1 and you want to replace values in "Column2", then you could use this syntax:

= Table.ReplaceValue(#"Changed Type", null, each if [Column3] = 1 then "x" else [Column2], Replacer.ReplaceValue,{"Column2"})

Just do a full replace with the UI and then tweak the red part of the formula.
For more information around this technique, please check my article here: Table.TransformColumns - alternative in PowerBI and PowerQuery in Excel (thebiccountant.com)

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 - but (to this very green Newbie) that sounds like it's still replacing a whole column. (I want to replace one cell in a column, which unfortunately currently has a Null value, so if I replace that with X it will make all the other Null cells in that column change to X. - I want just this one cell to change from Null to X.)

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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.