Forum Discussion
Retrieving Sum from Prior Period
Hello all...
I'm looking for guidance on how to create a measure/measures that will retrieve the sum total from the prior period, in this case $4.00, that I can then use to subtract from the current period total, in this case $8.00. I will be inserting the difference between the 2 values in a table, sorted by project ID.
Thanks in advance to anyone who can help!
| Project | Period | InsertedDate | Value |
| A | 1 | 6/1/2020 | $1.00 |
| B | 1 | 6/1/2020 | $1.00 |
| C | 1 | 6/1/2020 | $1.00 |
| D | 1 | 6/1/2020 | $1.00 |
| A | 2 | 6/15/2020 | $2.00 |
| B | 2 | 6/15/2020 | $2.00 |
| C | 2 | 6/15/2020 | $2.00 |
| D | 2 | 6/15/2020 | $2.00 |
10 Replies
- Ashish_MathurSuper User
Hi,
Will the difference between 2 period always be 14 days?
- AnonymousNot applicable
Yes it should be.
- Ashish_MathurSuper User
- amitchandakSuper User
Anonymous , Move period to separate table , say Period
and then try
This Period = CALCULATE(sum('Table'[Value]), FILTER(ALL('Period'),'Period'[Period]=max('Date'[Period])))
Last Period = CALCULATE(sum('Table'[Value]), FILTER(ALL('Period'),'Period'[Period]=max('Date'[Period])-1))Very similar approach I used in Week here
- AnonymousNot applicable
amitchandak Thanks but I can't move the period to a separate table in this case.
- amitchandakSuper User
Anonymous , Try like
This Period = CALCULATE(sum('Table'[Value]), FILTER(ALLSELECTED('Table'),'Table'[Period]=max('Table'[Period])))
Last Period = CALCULATE(sum('Table'[Value]), FILTER(ALLSELECTED('Table'),'Table'[Period]=max('Table'[Period])-1))