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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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

@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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.