Forum Discussion
Help With Date Formatting
the reason that's not working is because the dates in PowerBI can't be converted in the way that you have done it. For example, if you convert the whole number 0, the date is 30/12/1899. so when you convert 202301 to a date, you're getting the date 202301 days after 1899. The formatting just changes the way the data is displayed, but it doesn't change the underlying data.
To fix this, I suggest two things - the first is to go back to the source of the raw data and provide a proper date there. PowerBI should be able to handle the date conversion if provided a data in a normal date format. If this isn't possible, you can try to convert your column using a DAX calculated column.
We'll need to extract the year and month, then convert both to dates. Something like the following should work:
Column =
var monthPart = RIGHT(FORMAT([month_date_yyyymm]), 2)
var yearPart = LEFT(FORMAT([month_date_yyyymm]), 4)
return DATE(yearPart, monthPart, 1)
this should return the 1st of each month as a date. Note: a date type requires a day, month and year. You can apply formatting to hide the date part in your actual visuals.