Forum Discussion
Taro_Gulat
1 year agoRegular Visitor
Timestamp difference average
Hi all, I am having a difficulty in calculating an average value for the below scenario: in the above mentioned table i need to calculate always starting from step 2 (step 1 always exc...
- 1 year ago
you can try this
Measure =var a=minx(FILTER('Table','Table'[Item]="A"),'Table'[Date])var b=minx(FILTER('Table','Table'[Item]="B"),'Table'[Date])return ABS(DATEDIFF(a,b,MINUTE))Measure 2 = averagex(VALUES('Table'[Steps]),[Measure])then unselect step 1 in the table visual filterpls see the attachment below - Anonymous1 year ago
Hi Taro_Gulat
Thanks for the reply from FarhanJeelani and ryan_mayu .
Taro_Gulat , Please refer to the following test.
Create two measures as follow
Min = CALCULATE(MIN('Table'[Date]), ALL('Table'), 'Table'[Steps] <> "Step1", 'Table'[Steps] = MAX('Table'[Steps]), 'Table'[Item] = MAX('Table'[Item]))Average = VAR _minA = MINX(FILTER('Table', 'Table'[Steps] = MAX('Table'[Steps]) && 'Table'[Item] = "A"), [Min]) VAR _minB = MINX(FILTER('Table', 'Table'[Steps] = MAX('Table'[Steps]) && 'Table'[Item] = "B"), [Min]) VAR _DateDiff = IF(MAX([Steps]) <> "Step1", ABS(DATEDIFF(_minB, _minA, MINUTE))) VAR _count = CALCULATE(DISTINCTCOUNT('Table'[Steps]), 'Table'[Steps] <> "Step1") VAR _result = DIVIDE(_DateDiff, _count) RETURN _resultOutput:
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ryan_mayu
Super User
1 year agoyou can try this
Measure =
var a=minx(FILTER('Table','Table'[Item]="A"),'Table'[Date])
var b=minx(FILTER('Table','Table'[Item]="B"),'Table'[Date])
return ABS(DATEDIFF(a,b,MINUTE))
Measure 2 = averagex(VALUES('Table'[Steps]),[Measure])
then unselect step 1 in the table visual filter
pls see the attachment below