Forum Discussion
Anonymous
6 years agoNot applicable
convert number to date
Hi, I have a date column I'm trying to import that is stored in the CSV file as numbers. I've tried converting the column to date but it doesn't recognise the date format I'm trying to use so it g...
- 6 years ago
Anonymous
please try to create a column
Column = VAR formatchange="0"&'Sheet24'[date] VAR _newdate=if(LEN('Sheet24'[date])=5,formatchange,'Sheet24'[date]) VAR _day=LEFT(_newdate,2) Var _month=mid(_newdate,3,2) VAR _year="20"&RIGHT(_newdate,2) return date(_year,_month,_day)However, I fixed the year start from 2000, do you have any years before 2000? If so, then you need to modify the DAX.
ryan_mayu
Super User
6 years agoAnonymous
please try to create a column
Column =
VAR formatchange="0"&'Sheet24'[date]
VAR _newdate=if(LEN('Sheet24'[date])=5,formatchange,'Sheet24'[date])
VAR _day=LEFT(_newdate,2)
Var _month=mid(_newdate,3,2)
VAR _year="20"&RIGHT(_newdate,2)
return date(_year,_month,_day)However, I fixed the year start from 2000, do you have any years before 2000? If so, then you need to modify the DAX.
Anonymous
6 years agoNot applicable
Thank Ryan, this worked perfectly after I swapped in my column names!
Amit I didn't test your answer as Ryan's came in first sorry. Thank you for responding though! I'm sure I'll have another question for you this week 🙂
Kind Regards,