Maurizio Loffredo

My feedback

  1. 313 votes
    Sign in
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    21 comments  ·  Power BI Ideas » Data Preparation  ·  Flag idea as inappropriate…  ·  Admin →
    An error occurred while saving the comment
    Maurizio Loffredo commented  · 

    Hi All,

    After waiting for ages, I realized that "every man for himself" would have worked much better than Microsoft Engineers.

    So, based on some comments (herein, thanks guys) which refer to some useful web resources, the best way to get this is by creating a lean, separate, custom function to Invoke into your calendar table when adding the ISO Week Column.

    Here it is:

    ISO8601Week = (Date as date) =>
    AncillaryWeek = (Date as date) =>
    WeekDay = 1 + Date.DayOfWeek(Date, Day.Monday),
    OrdinalDay = Date.DayOfYear(Date),
    AncillaryWeekNumber = Number.RoundDown((OrdinalDay - WeekDay + 10) / 7)

    ThisYear = Date.Year(Date),
    PriorYear = ThisYear - 1,
    AncillaryNumber = AncillaryWeek(Date),
    LastWeekOfPriorYear = AncillaryWeek(#date(PriorYear, 12, 28)),
    LastWeekOfThisYear = AncillaryWeek(#date(ThisYear, 12, 28)),
    WeekNumber = if AncillaryNumber < 1 then LastWeekOfPriorYear else
    if AncillaryNumber > LastWeekOfThisYear then 1 else AncillaryNumber

    Maurizio Loffredo supported this idea  · 

Feedback and Knowledge Base

Ready to get started?

Try new features of Power BI today by signing up and learn more about our powerful suite of apps.