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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Problem with variant data type in calculated column

I am trying to use an if statement that uses a "fake" date when an order haven't been assigned a arrival date. 

 

But when writing this seemingly easy piece of code I get the below error message saying that it "can't return a variant data typ..."

 

Variant.PNG

There has to be a way around this. Does anyone know? 

 

Thanks in advance! 

1 ACCEPTED SOLUTION
Aditya_Meshram
Solution Supplier
Solution Supplier

Hi @Anonymous 
try using DATE(2999,12,31) in the second argument of IF() statement in place of "2999-12-31"

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for both answers! 

 

However I've tried that before and yes, the code works. But then I instead face the problem that Arival-date has the wrong data type. The end result is a column where I can change the type to Date (so that I can use a Date interval as a slicer).  Variant.PNG

daXtreme
Solution Sage
Solution Sage

"2999-12-31" is a string, not a real date. Use the DATE function.

Aditya_Meshram
Solution Supplier
Solution Supplier

Hi @Anonymous 
try using DATE(2999,12,31) in the second argument of IF() statement in place of "2999-12-31"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.