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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Rio007
Helper I
Helper I

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

 I'm having a table where I'm trying to categrorise all the date before 1/1/2000 as bad and after 1/1/2000 the actual date from each corresponding row.
This is the DAx I wrote:

Draft = IF ( 'TableA'[A] >=153864"bad" , 'Fact'[A). I also tried this
Draft = IF( CONVERT('TableA'[A],STRING)>="153864","bad",'TableA'[A])

and this is the error I Get  "Expressions that yield variant data-type cannot be used to define calculated columns."

I tried several versions of if but I still get the same error. Thank You for helping me with this.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I think you need to use the CONVERT function a second time, assuming [A] is an integer.

Try: Draft = IF( CONVERT('TableA'[A],STRING)>="153864","bad",CONVERT(TableA'[A], STRING))

View solution in original post

2 REPLIES 2
Rio007
Helper I
Helper I

@Anonymous  Thanks a lot that's the solution

Anonymous
Not applicable

I think you need to use the CONVERT function a second time, assuming [A] is an integer.

Try: Draft = IF( CONVERT('TableA'[A],STRING)>="153864","bad",CONVERT(TableA'[A], STRING))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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