Forum Discussion
WorkHard
5 years agoHelper V
Date Difference between two values in the same column with same Id
I'm trying to calculate the difference in days between two values in the same column that have the same id. Consider the following data: -EventId- -Start Date- -Desired Result- Event1 1/15...
- 5 years ago
Hi, WorkHard
You can create a column to calculate the dasired result.
Like this:
column = VAR a = MAXX ( FILTER ( ALL ( 'Table' ), [-Snapshot Date-] < EARLIER( 'Table'[-Snapshot Date-] ) && [-EventId-] = EARLIER( 'Table'[-EventId-] ) ), [-Snapshot Date-] ) VAR b = MAXX ( FILTER ( ALL ( 'Table' ), [-Snapshot Date-] = a && [-EventId-] = EARLIER( 'Table'[-EventId-] ) ), [-StartDate-] ) RETURN DATEDIFF ( b, 'Table'[-StartDate-] , DAY )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-janeyg-msft
5 years agoCommunity Support
Hi, WorkHard
Have your problem been solved? I can see from your dax code that you have two tables, but they don't appear in your description, such as 'end date' and 'snapshot date', You need to provide more detail information and the final result you want, then we can help you soon.
Best Regards
Janey Guo