Forum Discussion
Time stamps
- 3 years ago
Hi , RichardT_78
According to your description, you want to get the datediff between the latest timestamp each Car and the Now().
If this , you can refer to these steps .
(1)My test data is the same as yours.
(2)We can create a measure:
Measure = var _cur_car_table = FILTER(ALLSELECTED('Table') ,'Table'[Car ]= MAX('Table'[Car ])&& 'Table'[fault ]=1678) var _t2= ADDCOLUMNS(_cur_car_table,"minus" , ABS([Time stamp ]-NOW())) var _latest = MINX(_t2,[minus]) var _t3 = FILTER(_t2 ,[minus] = _latest) return DATEDIFF(MAXX(_t3,[Time stamp ]),NOW(),HOUR)(3)Then we can meet your need:
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 , RichardT_78
According to your description, you want to get the datediff between the latest timestamp each Car and the Now().
If this , you can refer to these steps .
(1)My test data is the same as yours.
(2)We can create a measure:
Measure = var _cur_car_table = FILTER(ALLSELECTED('Table') ,'Table'[Car ]= MAX('Table'[Car ])&& 'Table'[fault ]=1678)
var _t2= ADDCOLUMNS(_cur_car_table,"minus" , ABS([Time stamp ]-NOW()))
var _latest = MINX(_t2,[minus])
var _t3 = FILTER(_t2 ,[minus] = _latest)
return
DATEDIFF(MAXX(_t3,[Time stamp ]),NOW(),HOUR)
(3)Then we can meet your need:
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
Yes this is perfect , thank you very much, ive been scratching my head trying to find a solution. I tried lookup but due to multiple rows it didnt work.