Forum Discussion
Convert Number to Date
- 8 years ago
Hi faruux6,
By my tests, you could change the data tyoe in Query Editor.
1. Go to Query Editor and change the column type from number to text, then change the text type to date.
You should note that when you have a remind, you should select the add a new step. Then you will get the data type.
2. Close && Apply. Go to Power BI Data view and click the column and change the data format of the column to 2001(YYYY).
Hope this can help you!
Best Regards,
Cherry
- Anonymous8 years ago
My recommendation is to do it explictally as part of the Edit Query. If you have a column that contains only a Year Value, create a new column (Add Column -> Custom Column) called "YearStartDate". The formula in the UI box should be:
= Date.FromText(Number.ToText([Year]) & "-01-01")
This will tell Power BI that you want a date value of that given year, as 1st January. From here you can format the data as type Date. Then use the formatting suggestion of v-piga-msft
Very trivial but very useful. i almost got stuck and then realize power Bi can only indentify date in text but no date in numeric. great learning !!