Forum Discussion
DAX for datediff of values different rows
- 2 years ago
Hi patrickoleary85 ,
Based on your response, I understand that you want to see the date difference for all users. So, I made a modification to the test table Table as shown in the image. New column Diff between Receipt and Results and input:
Diff between Receipt and Results = VAR A = MAXX(FILTER('Table',EARLIER('Table'[User]) = 'Table'[User]),'Table'[Created].[Day]) VAR B = MINX(FILTER('Table',EARLIER('Table'[User]) = 'Table'[User]),'Table'[Created].[Day]) RETURN IF('Table'[Document Type]="Receipt",B-A,A-B)You can modify the DAX code according to your needs. Hope it works for you!
Best Regards,
Caroline Mei
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi patrickoleary85 ,
Based on your response, I understand that you want to see the date difference for all users. So, I made a modification to the test table Table as shown in the image. New column Diff between Receipt and Results and input:
Diff between Receipt and Results =
VAR A = MAXX(FILTER('Table',EARLIER('Table'[User]) = 'Table'[User]),'Table'[Created].[Day])
VAR B = MINX(FILTER('Table',EARLIER('Table'[User]) = 'Table'[User]),'Table'[Created].[Day])
RETURN
IF('Table'[Document Type]="Receipt",B-A,A-B)
You can modify the DAX code according to your needs. Hope it works for you!
Best Regards,
Caroline Mei
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This resolved it, thank you very much!