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
sureshdam18
Frequent Visitor

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

Hi, i am new to Power Bi.

while using the IF Statement, i am getting an error like this yield variant data-type cannot be used to define calculated columns 

Calculation is: IF(AND([Completion Status]="Open",[Status]="MD Ops Review - Delete"),Sheet1[NET_DAY],"") 

Can any one help me on this.

 

 

Thanks in Advance!

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @sureshdam18,

 

I think you are try to use both number value and text value in one calculate column so power bi can't auto analysis data type of this calculated column.

 

Maybe you can try to use 0 to replace "" part to keep similar data type or modify the column type to text.

Column=
IF (
    AND ( [Completion Status] = "Open", [Status] = "MD Ops Review - Delete" ),
    Sheet1[NET_DAY],
    0
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

9 REPLIES 9
Neha12
Frequent Visitor

Hi, 

I get the same error

I use column as

Count = Var A = calculate (countrows (table name)) Return if (isblank (A),"NA",A)

 

Thanks 

NMP02
Frequent Visitor

HI to all, may I know what seems to be the problem here?? The format is right but still get this king of error

 

Error problem.jpg

Anonymous
Not applicable

Hi, I have the same issue but I don't want to replace with zero because I want to have a measure based on that column (i.e. Days of travel CLEAR).

 

CityDays of travelDays of travel CLEAR
London20=if(City<>"",Days of travel,"")
 -4500 
London10 
v-shex-msft
Community Support
Community Support

Hi @sureshdam18,

 

I think you are try to use both number value and text value in one calculate column so power bi can't auto analysis data type of this calculated column.

 

Maybe you can try to use 0 to replace "" part to keep similar data type or modify the column type to text.

Column=
IF (
    AND ( [Completion Status] = "Open", [Status] = "MD Ops Review - Delete" ),
    Sheet1[NET_DAY],
    0
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

so how can i do it ? 

Thanks- I had the same issue and it was solved. 

How about my case ?

 

Please suggest me

 

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

 

truecondiation = IF(ISM[OData_{CH} Recommend0]=BLANK(),ISM[OData_{RNSP} TSS_x00],ISM[OData_{CH} Recommend0])

 

 

Hi,

 

I get the same error with today(), Any suggestions on how to fix this error?

 

cDate = IF([SharePointColumnD]="","",
IF([ICColumn]="",NOW(), [ICColumn]))

Hi @v-shex-msft

 

 

 

 

Thanks For the Replay,

Issue is Resolved.

 

 

 

Regards,

Suresh

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