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

Change text to date

Hello Everyone

 

I got a problem changing my text column into a date colum, i got the date like this 2018-01-10 (yy-mm-dd) but when I use this formula: 

real date =
IF (
    PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL] = "0000-00-00";
    BLANK ();
    DATE ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 4 )RIGHT ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 4 )2 )RIGHT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 2 ) )
)

my result is wrong: like this 10/6/2019 0:00:00, yes 2019 not 2018!

 

Does anyone Know what is happening?

Also the day is wrong

 

Thanks!

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

There existing a mistake when using above formula to extract Month value from text. 

 

Please modify it to:

 

real date =
IF (
    PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL] = "0000-00-00";
    BLANK ();
    DATE ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 4 ); RIGHT ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 7 ); 2 ); RIGHT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 2 ) )
)

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

There existing a mistake when using above formula to extract Month value from text. 

 

Please modify it to:

 

real date =
IF (
    PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL] = "0000-00-00";
    BLANK ();
    DATE ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 4 ); RIGHT ( LEFT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 7 ); 2 ); RIGHT ( PP_ORDENESPRODUCCION[FECHA_ENTREGA_REAL]; 2 ) )
)

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlB
Super User
Super User

Hi @Anonymous

 

Does it not work by changing the date type of the column from text to date?

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.