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
83dons
Helper III
Helper III

Replacing values in a column based on logic

I have a column with values between 0-100

 

However the data feeding this seems to have values over 100 such 101 and 131 and some nulls etc.

 

I have added a simple 'Replace Value' for nulls with 0. How do I replace any value 101 and over with 100? The Replace Value doesnt seem to allow such logic.

1 ACCEPTED SOLUTION
burakkaragoz
Community Champion
Community Champion

Hi @83dons ,

 

You’re right — the standard Replace Values option in Power Query doesn’t support conditional logic like “replace if greater than 100.”

Here’s how you can do it:

  1. Go to Power Query Editor
  2. Select Add Column > Conditional Column (or use a custom column)
  3. Use this logic:
   if [YourColumn] > 100 then 100 
   else if [YourColumn] = null then 0 
   else [YourColumn]
  1. If you want to overwrite the original column, you can use Transform > Replace Values with a Custom Column like:
   Table.AddColumn(#"Previous Step", "NewColumn", each if [YourColumn] > 100 then 100 else if [YourColumn] = null then 0 else [YourColumn])

Then just remove the original column and rename the new one.

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI

View solution in original post

2 REPLIES 2
BhavinVyas3003
Super User
Super User

You can create a custom column with this formula,

 

if [YourColumn] = null then 0
else if [YourColumn] > 100 then 100
else [YourColumn]


Thanks,
Bhavin
Problem solved? Hit “Accept as Solution” and high-five me with a Kudos! Others will thank you later!
burakkaragoz
Community Champion
Community Champion

Hi @83dons ,

 

You’re right — the standard Replace Values option in Power Query doesn’t support conditional logic like “replace if greater than 100.”

Here’s how you can do it:

  1. Go to Power Query Editor
  2. Select Add Column > Conditional Column (or use a custom column)
  3. Use this logic:
   if [YourColumn] > 100 then 100 
   else if [YourColumn] = null then 0 
   else [YourColumn]
  1. If you want to overwrite the original column, you can use Transform > Replace Values with a Custom Column like:
   Table.AddColumn(#"Previous Step", "NewColumn", each if [YourColumn] > 100 then 100 else if [YourColumn] = null then 0 else [YourColumn])

Then just remove the original column and rename the new one.

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI

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.