Forum Discussion
Complex Row Time Difference
Hi Team. Is there a way to reproduce this in Powerbi.?
This is the table I have to, in theory, I would like to subtract the time or duration between 2:36 PM and 2:50PM the same way I did in my excel file. Any idea on how to achieve this?
Thanks
9 Replies
- Greg_DecklerCommunity Champion
Anonymous See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous- AnonymousNot applicable
That did not work. Sorry
- v-henryk-mstfCommunity Support
Hi Anonymous ,
According to the table you provided, your purpose is to get the difference between the Time Out column and the next time value in Time IN column through power Bi. I did the following test: by defining two variables, var curindex is used to obtain the index value, var nextstratime is used to obtain the date value of the next row of the current row in the Start Time column, and finally the difference value is obtained by using the DATEDIFF function.
Best Regards,
HenryIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
I cant download the file, can you grant me access?
- v-henryk-mstfCommunity Support
There @carlosdajer ,
I am sorry for my behavior.
Here is the right sample pbix file.
Best Regards,
HenryIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Ashish_MathurSuper User
Hi,
Try this calculated column formula
=data[start time]-calculate(max(data[end time]),filter(data,data[start time]<earlier(data[start time])))
Hope this helps.