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
Jack2of3
Helper II
Helper II

IF ('A'[B] = BLANK(), 'A'[C], 'A'[D]) Cannot convert data type text to true/false

Going in circles. I need a column that does 3 evaluations on different fields and provides different results based on the different fields. Gives error cannot convert data type TEXT to TRUE/FALSE

 

REASSIGN =
IF(DetailCkReq[Batch_Str] = "REC", "RECURRING") ||
 
IF(DetailCkReq[CKREQ_ASSIGNMENT.CKREQ_NO.] = BLANK(),
DetailCkReq[NAME], DetailCkReq[CKREQ_ASSIGNMENT.ASSIGNED_TO]) ||
 
IF(DetailCkReq[BATCH_ASSIGNMENT.BATCH_NAME] = BLANK(),
DetailCkReq[NAME], DetailCkReq[BATCH_ASSIGNMENT.ASSIGNED_TO])
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Your DAX is trying to evaluate a logical combination of strings like "RECURRING" || "Detail Name" || "Detail Name", which doesn't make any sense since || can only combine True/False values, not text strings.

 

I think you may want something more like this:

REASSIGN =
SWITCH (
    TRUE (),
    DetailCkReq[Batch_Str] = "REC", "RECURRING",
    ISBLANK ( DetailCkReq[CKREQ_ASSIGNMENT.CKREQ_NO.] ),  DetailCkReq[NAME],
    ISBLANK ( DetailCkReq[BATCH_ASSIGNMENT.BATCH_NAME] ), DetailCkReq[NAME],
    DetailCkReq[BATCH_ASSIGNMENT.ASSIGNED_TO]
)

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

Your DAX is trying to evaluate a logical combination of strings like "RECURRING" || "Detail Name" || "Detail Name", which doesn't make any sense since || can only combine True/False values, not text strings.

 

I think you may want something more like this:

REASSIGN =
SWITCH (
    TRUE (),
    DetailCkReq[Batch_Str] = "REC", "RECURRING",
    ISBLANK ( DetailCkReq[CKREQ_ASSIGNMENT.CKREQ_NO.] ),  DetailCkReq[NAME],
    ISBLANK ( DetailCkReq[BATCH_ASSIGNMENT.BATCH_NAME] ), DetailCkReq[NAME],
    DetailCkReq[BATCH_ASSIGNMENT.ASSIGNED_TO]
)

Perfect! I knew it had to be possible I just couldn't wrap my head around it.

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi, @Jack2of3 
The results of your IF statements are Text Strings or false:
1 - is either "Recurring" or false
2 - is either [NAME] or [CKREQ_ASSIGNMENT.ASSIGNED_TO]
3 - [NAME] or [CKREQ_ASSIGNMENT.ASSIGNED_TO]

You have then included 1 or 2 or 3 which is expecting True/False , True/False or True/False.

I think you need to change the nesting of the conditions into a singe if statement.  However, I would consider moving this logic back into the Power Query.

I hope this helps point you in the right direction.

 

SWITCH(TRUE(),DetailCkReq[Batch_Str] = "REC", "RECURRING",
SWITCH (TRUE(),DetailCkReq[CKREQ_ASSIGNMENT.CKREQ_NO.] = BLANK(),
DetailCkReq[NAME], DetailCkReq[CKREQ_ASSIGNMENT.ASSIGNED_TO]),
 SWITCH(TRUE(),DetailCkReq[BATCH_ASSIGNMENT.BATCH_NAME] = BLANK(),
DetailCkReq[NAME], DetailCkReq[BATCH_ASSIGNMENT.ASSIGNED_TO]))

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.

Top Solution Authors