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
Anonymous
Not applicable

Problem using an if statement with a column name with a "/" in it

I have a line like this in my query:

 

= Table.ReplaceValue(#"Replaced Value11", each [CBT], each if [Customer Name/Customer ID]= "Sample Name" then "Something" else [CBT],Replacer.ReplaceValue,{"CBT"} )

 

and it generates an error in the if statement pointing to the text prior to the / saying Expression.SyntaxError: Invalid identifier.

 

However, if I change the column reference in the if statement to a column name without a / in it, it works fine.  Can someone explain why it doesn't like the / in the column name?  Will a / in the column name cause problems in other areas?

 

thanks,

1 ACCEPTED SOLUTION

Just a Syntax thing to handle special characters in Column Name. Ideally we shall avoid special characters in Name if not necessary.


View solution in original post

3 REPLIES 3
AnkitBI
Solution Sage
Solution Sage

Try below using #"Customer Name/Customer ID". 

 

= Table.ReplaceValue(#"Changed Type", each [CBT], each if [#"Customer Name/Customer ID"]= "Sample Name" then "Something" else [CBT],Replacer.ReplaceValue,{"CBT"} )

Thanks
Ankit Jain

Do Mark it as solution if the response resolved your problem. Do like the response if it seems good and helpful.

 

Anonymous
Not applicable

Thanks @AnkitBI  for the tip.  Do you know why the behavior in the if statement is different for column names with a / and those without?  Should I avoid using / in my column names?

 

thanks,

Chad

Just a Syntax thing to handle special characters in Column Name. Ideally we shall avoid special characters in Name if not necessary.


Helpful resources

Announcements
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!

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 Kudoed Authors