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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Variant Data in Column - Error Message

Hello,

 

I have a column that is summed in hours that I download from a cube.  It has numbers, blanks and the word infinity.  I am trying to replace the blanks and infinity with a zero so I can convert it to a decimal field.  My syntax and error is below.  

 

Would welcome your help in resolving.   ---Thank you!

 

Avg Time to Complete = if(AND(Intake[Avg Time To Completion In Hours] = "Infinity",NOT ISBLANK(Intake[Avg Time To Completion In Hours])),0,(Intake[Avg Time To Completion In Hours]))

 

Receive:  Expression that yield variant data-type cannot be used to define calculated columns.

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

This is the wrong approach. Go into the query editor (right click on the table, select edit query). Click on the column header and then select replace values and replace the items you need. Make sure you then set the number format before clicking close and load. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

5 REPLIES 5
MattAllington
Community Champion
Community Champion

This is the wrong approach. Go into the query editor (right click on the table, select edit query). Click on the column header and then select replace values and replace the items you need. Make sure you then set the number format before clicking close and load. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

This worked nicely.  Thank you!  Turns out I only needed to replace the word infinity, the nulls (or blanks) did not prevent me from converting the column to a decimal.

@Anonymous

 

Give this a try

 

Average time to complete =
IF (
    OR (
        Intake[Avg Time To Completion In Hours]
            = ( 1 / 0 ),
        ISBLANK ( Intake[Avg Time To Completion In Hours] )
    ),
    0,
    Intake[Avg Time To Completion In Hours]
)
Anonymous
Not applicable

Thank you for your response.   After replacing the "infinity" with zeros, I tried your syntax.   I still have the word null in some of my fields which is considered text.  So when I try your syntax, I receive this message:

 

DAX comparison operations do not support comparing values of type Text with values of type Number.  Consider using the VALUE or FORMAT function to convert one of the values.

 

But I am good to go now.  If in edit queries, I right click on the column and use the replace option for the word infinity, then the convert to decimal works for me as it accepts the nulls.

 

Thanks again for your help.

@Anonymous

 

or this

 

Average time to complete 2 =
IF (
    Intake[Avg Time To Completion In Hours]
        IN { 1 / 0, BLANK () },
    0,
    Intake[Avg Time To Completion In Hours]
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors