Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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!

ProjectPeriodInsertedDateValue
A16/1/2020$1.00
B16/1/2020$1.00
C16/1/2020$1.00
D16/1/2020$1.00
A26/15/2020$2.00
B26/15/2020$2.00
C26/15/2020$2.00
D26/15/2020$2.00
1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

Will the difference between 2 period always be 14 days?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Yes it should be.

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur The code works for the periods that end on the 15th of the month, but not for the periods on the first of the month. The expression to produce a value for the previous period is returning blanks for the 1st of the month. Any ideas as to why?

 

Capture.JPG

 

 

Hi,

Share the link from where i can download your PBI file.  CLearly show the result that you are expecting in the blank column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you @Ashish_Mathur . That definitely gets me closer to where I want to be. I need to play around with it a bit more because what I need to see in the June 15 column is what I'm seeing in the Total column.

 

 Capture.JPG

amitchandak
Super User
Super 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

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak  Thanks but I can't move the period to a separate table in this case.

@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))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks, I'll try that.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.