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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Expressions that yield variant data-type cannot be used to define calculated columns

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!

3 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@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")
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

az38
Community Champion
Community Champion

@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")

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Hi, @Anonymous 

Is  this your expected result ?

19.png

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"
        )
    )
)

 

pbix attached

 

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.

View solution in original post

6 REPLIES 6
az38
Community Champion
Community Champion

@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")

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi 

 

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!

 

 

amitchandak
Super User
Super User

@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")
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi 

 

 

 

 

 

Hi, @Anonymous 

Is  this your expected result ?

19.png

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"
        )
    )
)

 

pbix attached

 

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
Not applicable

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!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors