The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Solved! Go to Solution.
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]
)
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.
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]))