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 all,
I have the following column, and I wish to calculate the difference between each row - ie the length of time between Row 2 (20/08/18) and Row 1 (18/01/2017).
Any ideas on how to effectively do this?
Thanks!
Hi @Anonymous
Please try
Days Difference =
VAR SelectedDates =
ALLSELECTED ( 'Table'[Date] )
RETURN
SUMX (
VALUES ( 'Table'[Date] ),
VAR CurrentDate = 'Table'[Date]
VAR FilteredDates =
FILTER ( SelectedDates, 'Table'[Date] < CurrentDate )
VAR PreviousDate =
MAXX ( FilteredDates, 'Table'[Date] )
RETURN
IF ( PreviousDate <> BLANK (), INT ( CurrentDate - PreviousDate ) )
)
 
					
				
		
My apologies, the dates should have been in ascending order as in the screenshot below now. There are other rows that I'd rather not show if possible for privacy reasons (ie work related), but the dates should be the column by which the table is sorted.
And to answer your other question, a calculated column would be the ideal scenario.
Thank you for your help so far!
hi @Anonymous
do you have other columns?
Hi @Anonymous
The OFFSET function would work well here.
To come up with the exact DAX expression, we would need to clarify:
Regards,
Owen
 
					
				
				
			
		
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.
 
            | User | Count | 
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | 
| User | Count | 
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 10 | |
| 9 |