Forum Discussion
Puja
4 years agoHelper III
Duration Calculation
Hello Community, I need some help to calculate the duration based on an event. Based on those highlighted (screenshot below) dates , I need to calculate the duration. Anytime , 9999 or 7777 even...
- 4 years ago
Hi,
Please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below, and it is for creating a new column.
Result seconds CC = VAR _tableperproductnextdatetime = FILTER ( ADDCOLUMNS ( ADDCOLUMNS ( Data, "@nextdatetime", MINX ( FILTER ( Data, Data[Product name] = EARLIER ( Data[Product name] ) && Data[DateTime] > EARLIER ( Data[DateTime] ) ), Data[DateTime] ) ), "@diff", DATEDIFF ( Data[DateTime], [@nextdatetime], SECOND ) ), Data[Event] IN { 9999, 7777 } ) RETURN SUMMARIZE ( FILTER ( _tableperproductnextdatetime, Data[Product name] = EARLIER ( Data[Product name] ) && Data[Event] = EARLIER ( Data[Event] ) ), [@diff] ) - 4 years ago
Hi,
Please share your sample pbix file's link, and then I can try to look into it to come up with a solution.
Jihwan_Kim
4 years agoSuper User
Hi,
Please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below, and it is for creating a new column.
Result seconds CC =
VAR _tableperproductnextdatetime =
FILTER (
ADDCOLUMNS (
ADDCOLUMNS (
Data,
"@nextdatetime",
MINX (
FILTER (
Data,
Data[Product name] = EARLIER ( Data[Product name] )
&& Data[DateTime] > EARLIER ( Data[DateTime] )
),
Data[DateTime]
)
),
"@diff", DATEDIFF ( Data[DateTime], [@nextdatetime], SECOND )
),
Data[Event] IN { 9999, 7777 }
)
RETURN
SUMMARIZE (
FILTER (
_tableperproductnextdatetime,
Data[Product name] = EARLIER ( Data[Product name] )
&& Data[Event] = EARLIER ( Data[Event] )
),
[@diff]
)
Puja
4 years agoHelper III
- Jihwan_Kim4 years agoSuper User
Hi,
Please share your sample pbix file's link, and then I can try to look into it to come up with a solution.
- Puja4 years agoHelper III
Thank you Jihwan_Kim . Its working as expected :).