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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shane7mcdonald
Frequent Visitor

Change of value from second last date

Hi all, I'm trying to figure out how to make a measure that can give the value of the last date minus (-) the value of the second last date from each separate Id in a column. So, on any given day I should be able to tell from each item in a coumn what the change was from the last recorded date. Basically I'm after the variance.

 

Would love to hear any ideas! 

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Create 2 calculated columns, 

Latest date = 
Calculate(
MAX([Date]),
[ID]=EARLIER([ID]
)
Latest date -1 = 
Calculate(
MAX([Date]),
[ID]=EARLIER([ID],
[Date] <> [Latest Date]
)

Should give you the 2 dates you are looking for, then you can simply use them in a measure calculation,

Latest date amount = 
Calculate( Sum([amount]) , [Date] = selectedvalue([Latest date])
Latest date -1 amount = 
Calculate( Sum([amount]) , [Date] = selectedvalue([Latest date -1])

and finally

Difference = [Latest date amount] - [Latest date amount]

Connect on LinkedIn

View solution in original post

1 REPLY 1
tex628
Community Champion
Community Champion

Create 2 calculated columns, 

Latest date = 
Calculate(
MAX([Date]),
[ID]=EARLIER([ID]
)
Latest date -1 = 
Calculate(
MAX([Date]),
[ID]=EARLIER([ID],
[Date] <> [Latest Date]
)

Should give you the 2 dates you are looking for, then you can simply use them in a measure calculation,

Latest date amount = 
Calculate( Sum([amount]) , [Date] = selectedvalue([Latest date])
Latest date -1 amount = 
Calculate( Sum([amount]) , [Date] = selectedvalue([Latest date -1])

and finally

Difference = [Latest date amount] - [Latest date amount]

Connect on LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.