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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.