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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Cadu
New Member

Cannot convert value 'Occupation' of type Text to type True/False.

Hi, I have writen this new column and it returns the error: Cannot convert value 'Occupation' of type Text to type True/False.
Does someone know how to solve it?
New column =
(IF(OR
(ISBLANK(FACT_V[ROLE]),
FACT_V[ROLE]=""),RELATED(FACT_E[Roles]),
IF(RELATED(DIM_B[Occupation]),(FACT_V[ROLE]
))))
1 ACCEPTED SOLUTION
JorgePinho
Solution Sage
Solution Sage

I believe it is because of this part: "IF(RELATED(DIM_B[Occupation])," since the first argument of an if statement should be a logical test.

View solution in original post

2 REPLIES 2
KNP
Super User
Super User

Formatting the code would certainly make it easier to help. I think @JorgePinho is right about the bit he's highlighted, what were you expecting that to do/test for?

Consider using a SWITCH statement instead of nested IFs. It can make the logic much simpler. 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
JorgePinho
Solution Sage
Solution Sage

I believe it is because of this part: "IF(RELATED(DIM_B[Occupation])," since the first argument of an if statement should be a logical test.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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