Добавьте столбец к вашему запросу, чтобы преобразовать эпоху Unix в дату / время:
= Table.AddColumn(#"Changed Type", "Timestamp", each #datetime(1970,1,1,0,0,0) + #duration(0,0,0,[Unix Epoch Timestamp]), type datetime)
Если у вас еще нет таблицы измерений Customer, создайте ее:
Customers = SUMMARIZECOLUMNS ( Actions[Customer ID] )
Создание отношения на Customer ID
между [Actions]
и [Customers]
Теперь вы можете создать нужные меры:
Seconds Until Stage 2 =
VAR TimeStart =
MIN ( Actions[Timestamp] )
VAR TimeStage2 =
CALCULATE (
MIN ( Actions[Timestamp] ),
Actions[Action] = "Moved to Stage 2"
)
RETURN
IF (
HASONEVALUE ( Customers[Customer ID] ),
DATEDIFF (
TimeStart,
TimeStage2,
SECOND
),
BLANK()
)
Avg Seconds Until Stage 2 =
AVERAGEX (
Customers,
[Seconds Until Stage 2]
)
Seconds Stage 2 to Stage 3 =
VAR TimeStage2 =
CALCULATE (
MIN ( Actions[Timestamp] ),
Actions[Action] = "Moved to Stage 2"
)
VAR TimeStage3 =
CALCULATE (
MIN ( Actions[Timestamp] ),
Actions[Action] = "Moved to Stage 3"
)
RETURN
IF (
HASONEVALUE ( Customers[Customer ID] ),
DATEDIFF (
TimeStage2,
TimeStage3,
SECOND
),
BLANK()
)
Avg Seconds Stage 2 to Stage 3 =
AVERAGEX (
Customers,
[Seconds Stage 2 to Stage 3]
)
Seconds Stage 3 to Stage 4 =
VAR TimeStage3 =
CALCULATE (
MIN ( Actions[Timestamp] ),
Actions[Action] = "Moved to Stage 3"
)
VAR TimeStage4 =
CALCULATE (
MIN ( Actions[Timestamp] ),
Actions[Action] = "Moved to Stage 4"
)
RETURN
IF (
HASONEVALUE ( Customers[Customer ID] ),
DATEDIFF (
TimeStage3,
TimeStage4,
SECOND
),
BLANK()
)
Avg Seconds Stage 3 to Stage 4 =
AVERAGEX (
Customers,
[Seconds Stage 3 to Stage 4]
)
Вот пример рабочего файла PBIX: https://excel.solutions/so_54639352/