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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ashish_Mathur
Super User
Super User

Case insensitive replacement in Power Query

Hi,

This M code replaces old value with new values in the Particulars column

= List.Accumulate({0..List.Count(rename_particulars[Old name])-1},#"Removed line feed",(state,current)=>Table.ReplaceValue(state,rename_particulars[Old name]{current},rename_particulars[New name]{current},Replacer.ReplaceText,{"Particulars"}))

Rename_particulars is a 2 column table with wrong spellings in the Old name column and correct spellings in the new name column.  So this code iterates through each entry in the Particulars column of the current table, find the wrong spellings in the Odl name column and replaces them wit the correct spellings in the new name column.  However, this is case sensitive.  What modificiation can i make in this to make it case insensitive?

Thank you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
2 ACCEPTED SOLUTIONS
rohit1991
Super User
Super User

Hii @Ashish_Mathur 

 

Power Query text replacements are case-sensitive by default. To make them case-insensitive, we normalize both the source text and lookup values using Text.Upper or Text.Lower, and apply replacements via Table.TransformColumns instead of Replacer.ReplaceText.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

Tahreem24
Super User
Super User

@Ashish_Mathur Try this "Comparer.OrdinalIgnoreCase" . This particular function ignores case and applies ordinal rules for comparison.

 

https://learn.microsoft.com/en-us/powerquery-m/comparer-ordinalignorecase

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

4 REPLIES 4
v-priyankata
Community Support
Community Support

Hi @Ashish_Mathur 

Thank you for reaching out to the Microsoft Fabric Forum Community.

@rohit1991 @Tahreem24 Thanks for the inputs.

I hope the information provided by users was helpful. If you still have questions, please don't hesitate to reach out to the community. We are glad to help.

Thanks.

 

Hi @Ashish_Mathur 

Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.

 

Tahreem24
Super User
Super User

@Ashish_Mathur Try this "Comparer.OrdinalIgnoreCase" . This particular function ignores case and applies ordinal rules for comparison.

 

https://learn.microsoft.com/en-us/powerquery-m/comparer-ordinalignorecase

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
rohit1991
Super User
Super User

Hii @Ashish_Mathur 

 

Power Query text replacements are case-sensitive by default. To make them case-insensitive, we normalize both the source text and lookup values using Text.Upper or Text.Lower, and apply replacements via Table.TransformColumns instead of Replacer.ReplaceText.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.