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.
Dear Community,
I have the below formula that is returning the above error - please can you help me?
I'm trying to achieve a column that defines the status of a milestone based on dates. I already created previous formulas that were not working, but I did not get this error. And I am not mixing number and text values, so I can't figure out why is not working. Can you please help me?
Basically I want to define the status of the response milestone, based on the dates (response date, and target date). However and because I have multiple conditions I found easier to use the switch function:
Response Status =
SWITCH(TRUE(),
'main table'[Response Date]< 'main table'[Response_Target_Date], "Succeeded",
'main table'[Response Date]> 'main table'[Response_Target_Date], AND(OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]<TODAY()),"Noncompliant"),
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent",
"NA")
Thank You!
Solved! Go to Solution.
@Anonymous , Try like
Response Status =
SWITCH(TRUE(),
'main table'[Response Date]< 'main table'[Response_Target_Date], "Succeeded",
AND('main table'[Response Date]> 'main table'[Response_Target_Date], OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]<TODAY())),"Noncompliant",
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent",
"NA")
@Anonymous hi
the problem is somewhere in this part
'main table'[Response Date]> 'main table'[Response_Target_Date], AND(OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]<TODAY()),"Noncompliant"),
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent",
I was not able to understand the logic, but I can suppose that you have an incorrect first AND
try
Response Status =
SWITCH(TRUE(),
'main table'[Response Date] < 'main table'[Response_Target_Date], "Succeeded",
'main table'[Response Date] > 'main table'[Response_Target_Date] &&
(OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date] < TODAY()), "Noncompliant",
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date] > TODAY()), "Response not sent",
"NA")
Hi, @Anonymous
Is this your expected result ?
Try calculated column as below:
Response Status =
IF (
ISBLANK ( 'main table'[Response_Target_Date] ),
"N/A",
IF (
ISBLANK ( 'main table'[Response Date] )
&& 'main table'[Response_Target_Date] > TODAY (),
"Response not send",
IF (
'main table'[Response Date] <> BLANK ()
&& 'main table'[Response Date] <= TODAY ()
&& 'main table'[Response Date] < 'main table'[Response_Target_Date],
"Succeeded",
"Noncompliant"
)
)
)
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous hi
the problem is somewhere in this part
'main table'[Response Date]> 'main table'[Response_Target_Date], AND(OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]<TODAY()),"Noncompliant"),
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent",
I was not able to understand the logic, but I can suppose that you have an incorrect first AND
try
Response Status =
SWITCH(TRUE(),
'main table'[Response Date] < 'main table'[Response_Target_Date], "Succeeded",
'main table'[Response Date] > 'main table'[Response_Target_Date] &&
(OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date] < TODAY()), "Noncompliant",
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date] > TODAY()), "Response not sent",
"NA")
Hi az38,
Thanks you for your quick answer. The formula is not giving any error now.
However I have a problem with the Status. As you can see in the reply to amitchandak. Maybe you can help as well.
I am stuck and cannot move further with this.
Thank you!
@Anonymous , Try like
Response Status =
SWITCH(TRUE(),
'main table'[Response Date]< 'main table'[Response_Target_Date], "Succeeded",
AND('main table'[Response Date]> 'main table'[Response_Target_Date], OR(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]<TODAY())),"Noncompliant",
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent",
"NA")
Hi amitchandak,
Thanx for answering so quick!
The issue is now solved. However the formula is not retrieving the correct status:
AND(ISBLANK('main table'[Response Date]),'main table'[Response_Target_Date]>TODAY()),"Response not sent"
I am getting the "Succeeded" status with the Response Date in blank and the Target Date < Today.
And if the Target Date is missing it is appearing as " NA", even if the Response Date is blank.
Also if I have a Response Date, but not a Target Date it is appearing as "Noncompliant", which souldn't because if it does not have a target date.
I am realizing that I have a lot of conflicting conditions, and not sure how to proceed further with this.
Thanks for your help!
Hi, @Anonymous
Is this your expected result ?
Try calculated column as below:
Response Status =
IF (
ISBLANK ( 'main table'[Response_Target_Date] ),
"N/A",
IF (
ISBLANK ( 'main table'[Response Date] )
&& 'main table'[Response_Target_Date] > TODAY (),
"Response not send",
IF (
'main table'[Response Date] <> BLANK ()
&& 'main table'[Response Date] <= TODAY ()
&& 'main table'[Response Date] < 'main table'[Response_Target_Date],
"Succeeded",
"Noncompliant"
)
)
)
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-easonf-msft Thanks for your reply. That is exactly what I need. I've just replicate your formula in my pbix and... is working! You don't know how happy I am right now! Thank you so so much for your help!
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 |
---|---|
111 | |
97 | |
77 | |
62 | |
55 |
User | Count |
---|---|
142 | |
107 | |
89 | |
84 | |
65 |