Forum Discussion

sureshdam18's avatar
sureshdam18
Frequent Visitor
8 years ago
Solved

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!

 

  • Anonymous's avatar
    Anonymous
    8 years ago

    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

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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

    • sureshdam18's avatar
      sureshdam18
      Frequent Visitor

      Hi Anonymous

       

       

       

       

      Thanks For the Replay,

      Issue is Resolved.

       

       

       

      Regards,

      Suresh

    • PowerBINewbie_1's avatar
      PowerBINewbie_1
      Helper I

      Hi,

       

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

       

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

    • ssvr's avatar
      ssvr
      Helper III

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

       

       

  • Anonymous's avatar
    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 
  • NMP02's avatar
    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

     

  • Neha12's avatar
    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