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.
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]))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
44 | |
32 | |
30 | |
18 | |
17 |