Maurizio Loffredo

My feedback

  1. 233 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    14 comments  ·  Power BI Ideas » Analytics  ·  Flag idea as inappropriate…  ·  Admin →
    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:

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

    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
    in
    WeekNumber
    in
    ISO8601Week

    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.