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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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