Forum Discussion

morgancampbell's avatar
5 years ago
Solved

Offset a Column based on another column

My data is as follows:

 

WeekNameEmails Sent
38Person 1134
38Person 2237
38Person 3236
37Person 1127
37Person 2345
37Person 3198
etcetcetc

 

And I'm looking to add the 'Last Week Emails Sent' column. In this column I want to take 'Emails Sent' and offset it up by 1 week.

 

WeekNameEmails SentLast Week Emails Sent
38Person 1134127
38Person 2237345
38Person 3236198
37Person 1127107
37Person 2345234
37Person 3198175
etcetcetcetc

 

How would I go about this?

 

Thanks

  • You should be able to add a new column:

    Last Week Emails Sent =
    MAXX(FILTER(ALL(Table), Table[Name] = EARLIER(Table[Name]) && Table[Week] -1 = EARLER(Table[Week]) ), Table[Emails Sent] )

    You may also be able to get what you want using measures, but don't know what your ultimate goal is.
  • Hi morgancampbell ,

     

    You can use the following calculated column:

     

    Last Week Emails Sent = CALCULATE(SUM('Table'[Emails Sent]),FILTER('Table','Table'[Week] = EARLIER('Table'[Week])-1&&'Table'[Name] = EARLIER('Table'[Name])))

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai

2 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion
    You should be able to add a new column:

    Last Week Emails Sent =
    MAXX(FILTER(ALL(Table), Table[Name] = EARLIER(Table[Name]) && Table[Week] -1 = EARLER(Table[Week]) ), Table[Emails Sent] )

    You may also be able to get what you want using measures, but don't know what your ultimate goal is.
  • v-deddai1-msft's avatar
    v-deddai1-msft
    Community Support

    Hi morgancampbell ,

     

    You can use the following calculated column:

     

    Last Week Emails Sent = CALCULATE(SUM('Table'[Emails Sent]),FILTER('Table','Table'[Week] = EARLIER('Table'[Week])-1&&'Table'[Name] = EARLIER('Table'[Name])))

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai