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
Goodkat
Helper II
Helper II

Case insensitive column rename with mapping table

Dear friends of Power Query,

 

With the help of the forum, and two insightful websites (a big, big thank you to Imke Feldman thebiccountant.com and Rick de Groot gorilla.bi) I was able to further improve my data flows. Especially having unified naming of column names, disregardless from which chaotic source they are from, makes all following steps much easier. Hence, over the last days I came up with a long list of renamings and realized that doing this case insensitive would be beneficial as it reduces the number of master data entries I need to look after.

So with the help of Rick de Groot's Tutorial I managed a crisp case insensitive renaming of items when they are in a list.

 

Yesterday I reviewed another information source in which it does make most sense to replace directly in the column names. I thought to use the replacement in a list and implement it into the Table.TransformColumnNames.

And here I fail. I have tried since two hours various possible constellations which I have used on header renaming in the past; but without success. I also tried to combine it into a Table.RenameColumns, but never got it running.

 

Does anyone from the community have an idea how to use the replacement logic that works properly case insensitive also in a direct renaming of column names?

https://c.gmx.net/@324888734501700174/z3Eoy1QdSoyMiT3Bx-LraA

 

I am eager to learn, how I would need to adapt the code!

 

Thank you a lot in advance!

 

Best regards, Andreas

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use this as your next step

= Table.TransformColumnNames(Quelle, (x)=>try mdTable[NewText]{List.PositionOf(mdTable[OldText], x, 0,Comparer.OrdinalIgnoreCase)} otherwise x)

View solution in original post

2 REPLIES 2
Goodkat
Helper II
Helper II

Dear Vijay,

it works perfect. Brilliant! I have never seen the 'try' / 'otherwise' commands before!

Good learning! And the headers are now as they are supposed to.

 

Thank you so much!

Best regards, Andreas

Vijay_A_Verma
Super User
Super User

Use this as your next step

= Table.TransformColumnNames(Quelle, (x)=>try mdTable[NewText]{List.PositionOf(mdTable[OldText], x, 0,Comparer.OrdinalIgnoreCase)} otherwise x)

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.