Forum Discussion

catzw6699's avatar
catzw6699
Regular Visitor
2 years ago
Solved

Year&Week

 Hi ! Simple question I guess but cannot solve it. I have a column with Year & Week in text format e.g. 202408 (Year 2024 and Weekno 08). How do I convert this into a datecolumn?
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi catzw6699 ,

    The date data type in Power BI does not support year + week for now.
    And in addition to using Power Query, you can also use DAX:
    Use these DAXs to create calculated columns:

    Year = LEFT([YearWeek], 4)
    WeekNumber = RIGHT([YearWeek], 2)
    DateColumn = DATE([Year], 1, 1) + ([WeekNumber] - 1) * 7

    The final output is as below:

     

    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.