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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Analitika
Post Prodigy
Post Prodigy

Replace column values by condition

Hello,

 

How I could replace column values by specific condition. For example,  I am concatenating company name and journal code. 

I know that some companies journal codes contains $ character some not. I want replace concatenated column values $ if it contains company name "cname" etc.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Analitika ,

Pls test the below:

newvalue = IF(FIND("cname",'Table'[value],1,BLANK())<>BLANK(),"&"&""&'Table'[value],'Table'[value])

Then delete the before column and rename new column:

vluwangmsft_0-1653546943533.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

Hi @Analitika ,

Pls test the below:

newvalue = IF(FIND("cname",'Table'[value],1,BLANK())<>BLANK(),"&"&""&'Table'[value],'Table'[value])

Then delete the before column and rename new column:

vluwangmsft_0-1653546943533.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Arul
Super User
Super User

@Analitika ,

check this

New column = If(OR(CONTAINS('Journal code','Journal code'[Journalcode],"$"),'Journal code'[Companyname]="Cname"),
CONCATENATE('Journal code'[Companyname], SUBSTITUTE('Journal code'[Journalcode],"$","")),
CONCATENATE('Journal code'[Companyname],'Journal code'[Journalcode]))

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


rohit_singh
Solution Sage
Solution Sage

Hello @Analitika ,

Please refer to the solution here : 

https://community.powerbi.com/t5/Desktop/Replace-value-in-Power-Query-based-on-condition/td-p/136732...

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

amitchandak
Super User
Super User

@Analitika , you can replace in power query .

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

 

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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