Forum Discussion

davidibarrag's avatar
davidibarrag
Icon for Helper I rankHelper I
7 years ago
Solved

SELECT the starting day

Hello 

I want to know how to calculate a measure starting the week on friday so when I aggregate my measure by week in a vizual the caluclation of the weeks starts on friday and ends on thursday in every week. 

For example, in this chart i have my sales by week of the year, so I want to calculate my sales by week of the year but that every week start in friday and end in thursday, so i need a way to make my sales measure calculate my sales by week but starting on friday

  • Anonymous's avatar
    Anonymous
    7 years ago

    HI davidibarrag ,

    You can use following calculated column formula to check date and return week number.(Friday to Thursday)

    weeknum =
    IF (
        MONTH ( [Date] ) = 1
            && WEEKNUM ( [Date] - 4, 2 ) > 50,
        1,
        WEEKNUM ( [Date] - 4, 2 )
    )
    

    After you create above column, you can use it as condition of filter and summary records.

    Regards,

    Xiaoxin Sheng

3 Replies

    • davidibarrag's avatar
      davidibarrag
      Icon for Helper I rankHelper I

      Hello, i enter to the link you gave and that is not what i needed. Maybe i do not explain myself the right way. 

      I need to create a measure that calculate the sales by week of year and week of month, but each week need to start in thursday and end in friday, and graph that measure by week in Power BI. Hopefully i explain myself better this time.

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI davidibarrag ,

        You can use following calculated column formula to check date and return week number.(Friday to Thursday)

        weeknum =
        IF (
            MONTH ( [Date] ) = 1
                && WEEKNUM ( [Date] - 4, 2 ) > 50,
            1,
            WEEKNUM ( [Date] - 4, 2 )
        )
        

        After you create above column, you can use it as condition of filter and summary records.

        Regards,

        Xiaoxin Sheng