Forum Discussion
Anonymous
7 years agoNot applicable
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
- parry2k
Super User
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" )