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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply

How to calculate the difference between two measures based on a Date Column

hello everyone, 

I have a table with the following columns and measure: 

JSIQUEIYYCENB_0-1694817292662.png

I would need a measure (New Measure) to calculate the difference in Budget between the last available Report Date (9/30/2023) and the previous date right before (09/15/2023). The desired result is shown in the gree column above...any help from the experts will be really apprecited! thanks!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Report date column to the Date column of the Calendar Table.  To your visual, drag Date column from the Calendar Table.  Assuming Budget is a measure that you have already written, write this measure

Measure = [Budget]-calculate([budget],calculatetable(lastnonblank(Calendar[Date],calculate([budget])),datesbetween(calendar[date],minx(all(calendar[Date]),calendar[date]),min(calendar[date])-1)))

If this does not help, then share the download link of the PBI file.


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

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Report date column to the Date column of the Calendar Table.  To your visual, drag Date column from the Calendar Table.  Assuming Budget is a measure that you have already written, write this measure

Measure = [Budget]-calculate([budget],calculatetable(lastnonblank(Calendar[Date],calculate([budget])),datesbetween(calendar[date],minx(all(calendar[Date]),calendar[date]),min(calendar[date])-1)))

If this does not help, then share the download link of the PBI file.


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.