Forum Discussion
Compare between two timestamp with condition
- 3 years ago
Hi, Anonymous
Thanks for your sample data first!
Here are the steps you can refer to :
(1)This is my test data:(2)We can create a calcualted column like this:
Column = var _sse_date = IF([Field3]="SSE" , [StartDate] , BLANK()) var _t = FILTER('Table','Table'[StartDate]<_sse_date && 'Table'[Field3]= "X") var _max_startdate = MAXX(_t, [StartDate]) var _lastdate= MAXX(FILTER(_t,[StartDate] = _max_startdate) , [LastDate]) return _sse_date-_lastdateThen we can get the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, Anonymous
Thanks for your sample data first!
Here are the steps you can refer to :
(1)This is my test data:
(2)We can create a calcualted column like this:
Column = var _sse_date = IF([Field3]="SSE" , [StartDate] , BLANK())
var _t = FILTER('Table','Table'[StartDate]<_sse_date && 'Table'[Field3]= "X")
var _max_startdate = MAXX(_t, [StartDate])
var _lastdate= MAXX(FILTER(_t,[StartDate] = _max_startdate) , [LastDate])
return
_sse_date-_lastdate
Then we can get the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly