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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Calculated column difference between dates

Hi all. i have some data that looks like this

DATE REVENUE

August 100

September 150

October 250

 

This is cumulative and i want to see the difference from the previous month. so it should be

August=100, September = 50, December =100

 

How do i do that?

1 ACCEPTED SOLUTION
tarunsingla
Solution Sage
Solution Sage

Two things:
First, ensure your DATE field (column) is of Type "Date" (and not Text).
Second, you can create a calculated column using the formula below to get the difference in value.
 
Difference from PreviousMonth =
VAR earlier_month = CALCULATE(MAX('Table'[DATE]), FILTER('Table', 'Table'[DATE] < EARLIER('Table'[DATE])))
RETURN 'Table'[REVENUE] - LOOKUPVALUE('Table'[REVENUE], 'Table'[DATE], earlier_month)

View solution in original post

4 REPLIES 4
tarunsingla
Solution Sage
Solution Sage

Two things:
First, ensure your DATE field (column) is of Type "Date" (and not Text).
Second, you can create a calculated column using the formula below to get the difference in value.
 
Difference from PreviousMonth =
VAR earlier_month = CALCULATE(MAX('Table'[DATE]), FILTER('Table', 'Table'[DATE] < EARLIER('Table'[DATE])))
RETURN 'Table'[REVENUE] - LOOKUPVALUE('Table'[REVENUE], 'Table'[DATE], earlier_month)
Anonymous
Not applicable

When i do that i get a table of multiple values was supplied when a single value was expected. any thoughts?

parry2k
Super User
Super User

@Anonymous change you date column data type date and enter valid date, may be 1st of every month.

 

Add date dimension in your model, there are many posts on how to add one

set relationship between date dimension and your transaction table

 

from here everything will be super easy by adding measure, you can do all this in one measure as well.

 

Total Revenue = SUM ( Table[Revenue] )

PM Revenue = CALCULATE ( [Total Revenue], PREVIOUSMONTH( DateDimension[Date] ) )

Difference = [Total Revenue] - [PM Revenue]


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors