Forum Discussion
MichaelBalla
5 years agoNew Member
DATEDIFF by group
I have a dataset as shown below that I would like to calculate the average duration of each type based on the difference between the start and end times of each group. Sample Data Group Type...
- 5 years ago
Hi MichaelBalla
Create column as:
Duration = CALCULATE(DATEDIFF(MAX('Log'[StartTime]),MAX('Log'[EndTime]),SECOND))Create a measure as:
PartFabTime = AVERAGEX( FILTER( ALL('Log'), 'Log'[Type]=MAX('Log'[Type]) ), 'Log'[Duration] )Here is the output:
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
v-xulin-mstf
Community Support
5 years agoHi MichaelBalla
Create column as:
Duration =
CALCULATE(DATEDIFF(MAX('Log'[StartTime]),MAX('Log'[EndTime]),SECOND))
Create a measure as:
PartFabTime =
AVERAGEX(
FILTER(
ALL('Log'),
'Log'[Type]=MAX('Log'[Type])
),
'Log'[Duration]
)
Here is the output:
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!