cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chademe Frequent Visitor
Frequent Visitor

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

Accepted Solutions
AnkitBI Established Member
Established Member

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

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 Established Member
Established Member

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

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.

 

Highlighted
chademe Frequent Visitor
Frequent Visitor

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

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

AnkitBI Established Member
Established Member

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

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

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Top Kudoed Authors
Users Online
Currently online: 350 members 3,656 guests
Please welcome our newest community members: