Forum Discussion

Milozebre's avatar
Milozebre
Helper V
8 years ago
Solved

Week Number is INCORRECT

Good morning Community, 

 

I have a problem with the week numbers.

As you see, I see some measure for week 44 and we are in week 33.

 

SQL : 

,datepart(ww,A.D_CLOTTECH) AS WEEK_CLOTTECH 

 

I choose the right year but the problem still present.

 

 

 

 

 

 

 

 

 

 

 

 

 

Did you have any idea ? 

 

thank you 

 

 

 

 

 

 

 

 

 

 

 

  • Hello Lydia, 

     

    Sorry for the delay.

    I found the solution.

     

    here is the line in my query for the weeknumber : 

    ,datepart(ww,A.D_CLOTTECH) AS WEEK_CLOTTECH

     

    I look in internet and i found some solution and the easyer is change something in my query : change ww to ISO_WEEK

    ,datepart(ISO_WEEK,A.D_CLOTTECH) AS WEEK_CLOTTECH

     

    Now, its working :) 

     

    Thank you 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Milozebre,

    How do you create the measure? Could you please share sample data of your table? And create the following columns in your table and check which formula returns correct result.

    WeekNumber = WEEKNUM(Table[A.D_CLOTTECH],1)
    WeekNumber = WEEKNUM(Table[A.D_CLOTTECH],2)

    Regards,
    Lydia

    • Milozebre's avatar
      Milozebre
      Helper V

      Good Morning Lydia, 

       

      I dont create a measure for to get a weeknumber.

      its defined in the SQL query.

      Here is a view of the result.

       

       

      Thnak you 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Milozebre,

        Do you mean that you get different weeknumber after you import the table to Power BI Desktop by writing SQL query? If so, I am unable to reproduce the issue. Please share me the DDL and DML of your table so that I can test.



        Regards,
        Lydia