Forum Discussion
Change Date format to YYYYMM
Hi,
I have a date column in YYYYMMDD format, when I import to Power BI, the Data Type is Text.
I need to convert to Data Type "Date" and Date Format -> YYYYMM.
In the Modeling tab, the Data Type -> Date does not Format YYYYMM.
How do I achieve this without changing the Date Type "Date"? This column is used in Relationships while joining to other tables. Please advise.
Thanks,
Vishy
Hi,
In the Date Table, write this calculated column formula
=FORMAT('Date'[Date],"YYYYMM")
In the slier, drag this column.
Hope this helps.
13 Replies
- Ashish_MathurSuper User
Hi,
In the Query Editor, write this single M statement to convert YYYYMMDD to a proper date format
Date.From(Text.From([Date], "en-US"))
Hope this helps.
- AnonymousNot applicable
Hi Ashish,
Is there any way to do this using DAX?
Regards
Vishy
- Ashish_MathurSuper User
Hi,
Write this calculated column formula
=1*(DATE(LEFT('Table1'[Date],4),MID('Table1'[Date],5,2),RIGHT('Table1'[Date],2)))
Format this as Date.