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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
walkery
Helper I
Helper I

If Or Nested Statement with Text Values Getting Error

Hi - I have a column with employee names in it. For a couple of employee names I need their office to be changed to "corporate" rather than their office location. I put together the below test statement to see if I could get it to work with the "||" as an "Or" operator but I am getting an error when I try to add the column into a visualization. The error says: "conversion failed when converting the nvchar value 'user 1' to data type bit...". The employee name column is text formatted so not sure why I'm getting this error which I assume is like a data mismatch? 

 

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] = "User 1" || "User 2","Corporate",rvw_USAOBrokerReferrals[OTerritory])
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@walkery,

you can either use

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] = "User 1" || rvw_USAOBrokerReferrals[OBrokerName] = "User 2","Corporate",rvw_USAOBrokerReferrals[OTerritory])

or 

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] IN {"User 1", "User 2"},"Corporate",rvw_USAOBrokerReferrals[OTerritory])

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@walkery I think the issue is that for every option you should use the column implied on it

 

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] = "User 1" || rvw_USAOBrokerReferrals[OBrokerName] ="User 2","Corporate",rvw_USAOBrokerReferrals[OTerritory]).

 

I'm no 100% sure about, but try it

 

 

Anonymous
Not applicable

@walkery,

you can either use

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] = "User 1" || rvw_USAOBrokerReferrals[OBrokerName] = "User 2","Corporate",rvw_USAOBrokerReferrals[OTerritory])

or 

Column = IF(rvw_USAOBrokerReferrals[OBrokerName] IN {"User 1", "User 2"},"Corporate",rvw_USAOBrokerReferrals[OTerritory])

@Anonymous thanks! That was it. It always is the smallest syntax errors that seems to cause these errors! 🙂 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.