Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Augmenting data by week

Hi all,

 

I have a table like that


PERIOD         PLANT          TYPE

201801             A                 X
201801             B                 Y


Actually the table and values not important. I want to make some change on my table.  I need to augment the data like that.

PERIOD         PLANT          TYPE

20180101         A                 X
20180102         A                 X
20180103         A                 X
20180104         A                 X
20180101         B                 Y
20180102         B                 Y
20180103         B                 Y
20180104         B                 Y


I don't have to access to actual data (source is access) because of that i have to make that on power bi.  Is it possible ? If is it possible how can i do that ? 

Thanks.

A.

         

 

  • Stachu's avatar
    Stachu
    7 years ago

    if you just need 52 weeks for each entry then it's simple:

    1) in the query editor add a new column (name it WeekNr) with this syntax:

    {1..52}

    2) expand the values to rows

    3) create a new column which is 

    [Period]*100+[WeekNr]

    4) remove unnecessary columns

     
    EDIT what I don't get is that you say that you want it as in real calendar - if that's the  case why do you need week 51 for 201201 which to me seems to be January 2012? it only had 5 weeks at most. Or is it not related to month?

3 Replies

  • Stachu's avatar
    Stachu
    Community Champion

    you can do it in the query editor - do you always assume 4 weeks in a month or does it have to be related to the real calendar weeks? How do you want to show split weeks i.e. weeks that fall into 2 months?

    • Anonymous's avatar
      Anonymous
      Not applicable

      This table doesn't display the requested data. I create it for just show. It's demo.

      I have a period column which start 201201 to today (201811 -always last month ) and i want to augment it for 52 weeks. In summary i want to multiply each row data with 52 weeks.  I want it like real calendar
      For example 
      Period : 201201

      20120101
      20120102
      .
      .
      .
      20120151
      20120152


      Actually i don't know how to do in query editor

      • Stachu's avatar
        Stachu
        Community Champion

        if you just need 52 weeks for each entry then it's simple:

        1) in the query editor add a new column (name it WeekNr) with this syntax:

        {1..52}

        2) expand the values to rows

        3) create a new column which is 

        [Period]*100+[WeekNr]

        4) remove unnecessary columns

         
        EDIT what I don't get is that you say that you want it as in real calendar - if that's the  case why do you need week 51 for 201201 which to me seems to be January 2012? it only had 5 weeks at most. Or is it not related to month?