Forum Discussion
Extract month and year from date
- Anonymous5 years ago
Hi Anonymous
Did you use format function to build extract month and year?
If you use format "YYYY" and format "MM", "YYYYMM",your result will show text type.
Power Query:
Select Date column and click Date in Add column.
Then add a custom column and change it type to whole number.
Dax:
In addition to BA_Pete 's reply, use Year and Month function in calculated column.
If you want to show YearMonth try this dax.
Dax_YearMonth = YEAR('Table'[Date])*100+MONTH('Table'[Date])Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Did you use format function to build extract month and year?
If you use format "YYYY" and format "MM", "YYYYMM",your result will show text type.
Power Query:
Select Date column and click Date in Add column.
Then add a custom column and change it type to whole number.
Dax:
In addition to BA_Pete 's reply, use Year and Month function in calculated column.
If you want to show YearMonth try this dax.
Dax_YearMonth = YEAR('Table'[Date])*100+MONTH('Table'[Date])
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.