Forum Discussion
How to calculate productivity
- 6 years ago
Hi MaaPer ,
First of all, please create a index column in power query editor, then create calculated colmun using following:
Calculated column:
Time between Units = DATEDIFF ( [Process started], CALCULATE ( MIN ( 'Table'[Process started] ), 'Table','Table'[Index] > EARLIER('Table'[Index]) ), MINUTE )Work Segment = "Segment " & ROUNDDOWN(CALCULATE ( DISTINCTCOUNT ( 'Table'[Time between Units] ), 'Table', 'Table'[Process finished] < EARLIER ( 'Table'[Process finished] ), 'Table'[Time between Units] > 10 ),0) + 1Then create a new measure:
Work Time in Segment = DATEDIFF(MIN('Table'[Process started]),MAX('Table'[Process finished]),MINUTE)Update old measure as following:
Units/hr in Segment = DISTINCTCOUNT('Table'[Items produced]) / [Work Time in Segment] * 60Items = VAR fromTime = MIN ( 'TimeDim'[From] ) VAR toTime = MAX ( 'TimeDim'[To] ) VAR nowTime = DATE ( 2020, 3, 24 ) + TIME ( 14, 56, 0 ) RETURN IF( MINUTE ( toTime ) = MINUTE ( nowTime ) && DATEDIFF ( toTime, nowTime, MINUTE ) <= 60 * 8 && DATEDIFF ( toTime, nowTime, MINUTE ) >= 0,CALCULATE(DISTINCTCOUNT('Table'[Items produced]),'Table'[Process finished] > fromTime,'Table'[Process finished] <= toTime))Effective Work Time = VAR fromTime = MIN ( 'TimeDim'[From] ) VAR toTime = MAX ( 'TimeDim'[To] ) VAR nowTime = DATE ( 2020, 3, 24 ) + TIME ( 14, 56, 0 ) RETURN IF ( MINUTE ( toTime ) = MINUTE ( nowTime ) && DATEDIFF ( toTime, nowTime, MINUTE ) <= 60 * 8 && DATEDIFF ( toTime, nowTime, MINUTE ) >= 0, CALCULATE ( SUM ( 'Table'[Time of processing] ), 'Table'[Process started] >= fromTime, 'Table'[Process finished] <= toTime ) )If you have any other questions , please kindly ask here and we will try to resolve it.
By the way, PBIX file as attached.
Best regards,
Dear v-lid-msft ,
Your solution works like magic!
I'm sure it will take some days to me to fully understand it, but I'm very gratefull for giving me that help and that opportunity to continue learning.
Do you mind if I'll get back to you with some doubts about the solution in the following days?. I want to take the opportunity to learn about it and not only make a copy-paste.
Many thanks again.
Hi MaaPer ,
Sure, If you have any other questions, please kindly ask here and we will try to resolve it. But beg to be excused that we may have some delay in response.
Best regards,