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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Applicable88
Impactful Individual
Impactful Individual

Variant Datatype calculated column with String and Date

Hello,

I have a joined table , where orders got a finish time and a fetch time. When an order is ready, but nobody fetch it yet, intead of fetch datetime I want a string returning "not fetched yet".

But since its a mixture of Date and string datatype I get the variant datatype error message. 

Basically like this:

OrdernumberFinishtime Fetchtime
1234 01.01.2021 not fetched yet
1235 02.01.2021 03.01.2021
1236 03.01.2021 03.01.2021
1237 07.01.2021 09.01.2021
1238 08.01.2021 not fetched yet
1239 09.01.2021 not fetched yet

 

I tried with formatting the date time into a string, but it showed weird numbers, since it is in the standard 

date format like DD.MM.YYYY anymore. 

 

Thank you very much in advance.

Best. 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Applicable88 , You need a text column like

 

if(isblank([Fetchtime]) , format([FetchDate], "DD.MM.YYYY") , "not fetched yet")

View solution in original post

2 REPLIES 2
Thejeswar
Resident Rockstar
Resident Rockstar

Hi @Applicable88 ,

Assuming your Fetchtime and Finishtime columns are of date datatype, You might have to create a new column as below

new_fetch = IF(ISBLANK(order_finish_fetch[Fetchtime]), "Not Fetched Yet", FORMAT(order_finish_fetch[Fetchtime],"dd.mm.yyyy"))

Screenshot below with both fetchtime and new_fetch (as per your need)

Thejeswar_0-1642581659908.png

 

amitchandak
Super User
Super User

@Applicable88 , You need a text column like

 

if(isblank([Fetchtime]) , format([FetchDate], "DD.MM.YYYY") , "not fetched yet")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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