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

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.

Reply
Anonymous
Not applicable

Replace only some values in a column

I'm just starting out with Power BI so any help will be most appreciated.
Is it possible to select some cells in a column and replace text only in those?
For example I have the number 12 in a number of cells in column A but I only want to change 12 to 2 for some of them based on the value of a different column. Example change 12 to 2 where month is February but not where month is March.
It doesn't seem possible to just highlight the rows I want to change and then select the replace feature as I would do in Excel.
 
Thank you.
 
1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The easiest way would be to add an extra Conditional Column in Power Query/Transform data specifying your conditions.

image.png

Happy to assist further if you can provide a data sample.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , In power query M you have If else

example

New Margin = ((if [Item.Brand] = "Brand 1" then 5 else
if [Item.Brand] = "Brand 2" then 5.5 else
if [Item.Brand] = "Brand 3" then 6.0 else
if [Item.Brand] = "Brand 4" then 6.5 else
7.0 )*([Qty]*[Price]) *((100-[Discount Percent])/100))/100

 

And text function https://docs.microsoft.com/en-us/powerquery-m/text-functions

 

with help of that you can do that

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The easiest way would be to add an extra Conditional Column in Power Query/Transform data specifying your conditions.

image.png

Happy to assist further if you can provide a data sample.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Thank you @Mariusz this worked for me, but have since noticed that you can only include 1 conditional - eg: you can't say If column A = 5 AND Column B = 5 so for some other transformations I'm looking at other things. Having an issue with concatenating 2 columns now but will post a separate question I think.

By the way the dataset I'm trying to transform is Avi Singh's Ultimate Calendar table - I'm changing it to suit my companies fiscal year.

Anonymous
Not applicable

Ah yes thank you I hadn't found that, it looks like it could work I will try it - many thanks.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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