Forum Discussion

mr_oli's avatar
mr_oli
Helper I
6 years ago
Solved

Adding value from previous week to next week

Hello!


I am looking for a way to add value from previous week to next week and so on with same Product ID and same Location ID


This is what I got:

ProductLocationWeekValue
1a123301
1a123311
1a123321
1a123331
1a12334

1

 

And this is what I want to have:

ProductLocationWeekValue
1a123301
1a123312
1a123323
1a123334
1a123345

 

 

 

 

  • Hi mr_oli ,

     

    Could you try this formula:

    Cumulative Value =
    CALCULATE(
         SUM(Sheet1[Value]),
         ALLEXCEPT(Sheet1,Sheet1[Product],Sheet1[Location]),
         Sheet1[Week]<=EARLIER(Sheet1[Week])
    )
     
     
    Cheers,
    Nemanja
     
  • Hi, mr_oli 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

     

     

    You may create a measure as below.

    Result = 
    CALCULATE(
            SUM('Table'[Value]),
            FILTER(
                ALL('Table'),
                'Table'[Product]=SELECTEDVALUE('Table'[Product])&&
                'Table'[Location]=SELECTEDVALUE('Table'[Location])&&
                'Table'[Week]<=SELECTEDVALUE('Table'[Week])
            )
    )

     

    Result:

     

    Best Regards

    Allan

     

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

     

6 Replies