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
Sime
Helper I
Helper I

Row Difference BY Period

Hi All,

 

I am calculating Earned Value by period based on the % of movement mulitplied by a budget figure.
On occassion the budget figure changes and therefore the total EV is not accurate due to the change in the budget at that given time.

 

What I would like to do is include a column that calculates the difference between the rows so I can mulitply this by the previous % value and then sum that with the total EV when applicable.

 

A sample of the data is posted below:

 

PeriodPrevious %Overall %BudgetDifference
30/09/20230000
31/10/2023020401,932.00401,932.00
30/11/20232052669,156.00267,224.00
31/12/20235274669,156.000

 

Any help would be appreciated. Thank you.

 

Edit: @Ashish_Mathur @Greg_Deckler Thank you for your responses.  I have updated the Difference column to reflect the expected results as requested.

2 ACCEPTED SOLUTIONS

Hi,

Assuming you have a Calendar Table with a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table AND to your visual, you have dragged Month and Year from the Calendar Table, write these measures:

Previous month budget = calculate([Budget],previousmonth(Calendar[date]))

Diff = [Budget]-[Previous month budget]

Hope this helps.


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

View solution in original post

Anonymous
Not applicable

Hi @Sime 

 

If your source data table is like the sample data provided, you can create a calculated column with below DAX:

Difference = 
var curMonth = 'Table'[Period]
var preBudget = CALCULATE(SUM('Table'[Budget]),ALL('Table'),'Table'[Period]=EOMONTH(curMonth,-1))
return
'Table'[Budget] - preBudget

vjingzhanmsft_0-1708509749129.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Sime 

 

If your source data table is like the sample data provided, you can create a calculated column with below DAX:

Difference = 
var curMonth = 'Table'[Period]
var preBudget = CALCULATE(SUM('Table'[Budget]),ALL('Table'),'Table'[Period]=EOMONTH(curMonth,-1))
return
'Table'[Budget] - preBudget

vjingzhanmsft_0-1708509749129.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Ashish_Mathur
Super User
Super User

Hi,

Based on the table that you have shared, show the expected result very clearly.


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

Hi Ashish, I have added the expected "Difference" values to the sample table data below and to the original thread:

 

PeriodPrevious %Overall %BudgetDifference
30/09/20230000
31/10/2023020401,932.00401,932.00
30/11/20232052669,156.00267,224.00
31/12/20235274669,156.000

 

Any help would be appreciated. Thank you.

Hi,

Assuming you have a Calendar Table with a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table AND to your visual, you have dragged Month and Year from the Calendar Table, write these measures:

Previous month budget = calculate([Budget],previousmonth(Calendar[date]))

Diff = [Budget]-[Previous month budget]

Hope this helps.


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

@Sime See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
  __Current - __Previous



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.