Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I'm struggling finding the difference of value between dates. They are irregular and aren't monthly or yearly. 
My desired outcome would be a measure that calculates difference and change of the value.
something that looks like difference column
thanks
| Code | region | test date | score | difference | 
| A | US | 05/07/19 | 90 | 0 | 
| A | US | 09/08/19 | 130 | 40 | 
| A | CA | 10/07/19 | 50 | 0 | 
| B | US | 05/07/19 | 80 | 0 | 
| B | US | 09/08/19 | 70 | -10 | 
| B | CA | 10/07/19 | 75 | 0 | 
Solved! Go to Solution.
@Anonymous , Try as new columns
last date = maxx(filter(Table, Table[Code] = earlier(Table[Code])&& Table[region] = earlier(Table[region]) && Table[Date] < earlier(Table[Date])),Table[Date])
difference = Table[score] - maxx(filter(Table,  Table[Code] = earlier(Table[Code])&& Table[region] = earlier(Table[region])  && Table[Date] = earlier(Table[last date])),Table[score])
As new measures
Last Day Non Continous = CALCULATE(sum('Table'[score]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),'Table'['DAte'])))
Change = sum('Table'[score])- [Last Day Non Continous]
@Anonymous , Try as new columns
last date = maxx(filter(Table, Table[Code] = earlier(Table[Code])&& Table[region] = earlier(Table[region]) && Table[Date] < earlier(Table[Date])),Table[Date])
difference = Table[score] - maxx(filter(Table,  Table[Code] = earlier(Table[Code])&& Table[region] = earlier(Table[region])  && Table[Date] = earlier(Table[last date])),Table[score])
As new measures
Last Day Non Continous = CALCULATE(sum('Table'[score]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),'Table'['DAte'])))
Change = sum('Table'[score])- [Last Day Non Continous]
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved. 
If you found this post helpful, please give Kudos  C 
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query. 
www.excelwithallison.com
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.