Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Change Text field to Date format

Hi All,

 

I have a column 'Period Key' which is used to join fact table and dim_date. This column has data of type string as 20170928. I am trying to to change this to date for below calculation.

 

TestDateFormat = FORMAT('Fact Table'[Period Key], "YYYY/MM/DD")
 
But it does not give me data for desired format. i want the data as 2017/09/28 (date type)
Looking for help.
 
Thanks.
 
  • Anonymous try this , add as new column

     

    Date = FORMAT( DATE( LEFT( Table1[PeriodKey], 4 ), MID( Table1[PeriodKey], 5, 2), RIGHT( Table1[PeriodKey], 2 )) , "YYYY/MM/DD" )

1 Reply

  • Anonymous try this , add as new column

     

    Date = FORMAT( DATE( LEFT( Table1[PeriodKey], 4 ), MID( Table1[PeriodKey], 5, 2), RIGHT( Table1[PeriodKey], 2 )) , "YYYY/MM/DD" )