Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Unique timeline from the overlapping time stamp

Hello Everyone,

 

I am trying to summarize the timeline of resources who are logging in 'downtime' for the applications.

The details from the PowerApps is captured in the below format:

EmployeeApp CategoryStart TimeEnd TimeDifferenceSupervisorDepartmentLocationResolved by
Resource 1Application 12/4/2021 15:352/4/2021 15:400:05:06Supervisor 1Department 1ChennaiAgent 1
Resource 1Application 12/4/2021 15:352/4/2021 15:400:05:06Supervisor 1Department 1ChennaiAgent 1
Resource 1Application 22/4/2021 15:352/4/2021 15:400:05:06Supervisor 1Department 1ChennaiAgent 1
Resource 1Application 32/4/2021 15:352/4/2021 15:400:05:06Supervisor 1Department 1ChennaiAgent 1
Resource 2Application 12/4/2021 15:412/4/2021 15:420:00:25Supervisor 2Department 2ChennaiAgent 1
Resource 2Application 22/4/2021 15:422/4/2021 15:430:00:38Supervisor 2Department 2ChennaiAgent 1
Resource 3Application 42/4/2021 15:522/4/2021 16:551:03:03Supervisor 3Department 3ChennaiAgent 1
Resource 3Application 22/4/2021 15:522/4/2021 16:551:03:03Supervisor 3Department 3ChennaiAgent 1
Resource 4Application 52/4/2021 17:582/4/2021 17:590:00:15Supervisor 4Department 4UKAgent 1
Resource 5Application 22/4/2021 17:582/4/2021 21:253:27:06Supervisor 4Department 4UKAgent 1
Resource 6Application 62/4/2021 17:582/4/2021 17:590:00:08Supervisor 2Department 4UKAgent 2
Resource 4Application 12/4/2021 17:582/4/2021 21:253:26:58Supervisor 4Department 4UKAgent 1
Resource 5Application 42/4/2021 22:412/4/2021 23:220:41:43Supervisor 5Department 5ChennaiAgent 1

 

I tried using @Greg_Deckler 's solution on Properly summing up time spent in overlapping appointments however My end result was something different than expected.

 

I would like to summarize information based on the Resource name & date as well as the downtime of applications over a period of time.

 

My expected output could look something like this:

 

Resource Name4-Feb Downtime
Resource 10:05:06
Resource 20:01:03
Resource 31:03:03
Resource 43:26:58
Resource 54:08:49
Resource 60:00:08

 

Can I please ask for your help in this regard?

 

Sincerely,

Raj

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may create a measure as below.

Result Measure = 
SUMX(
    SUMMARIZE(
        'Table',
        'Table'[Employee],
        "Result",
        CALCULATE(
            SUM('Table'[Difference]),
            FILTER(
                'Table',
                MONTH([Start Time])=2&&
                DAY([Start Time])=4
            )
        )
    ),
    [Result]
)

 

Result:

a2.png

 

Or you can create the following calculated table.

Table 2 = 
SUMMARIZE(
        'Table',
        'Table'[Employee],
        "Result",
        CALCULATE(
            SUM('Table'[Difference]),
            FILTER(
                'Table',
                MONTH([Start Time])=2&&
                DAY([Start Time])=4
            )
        )
)

 

Result:

a3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello Allan,

 

Thanks for the above solution, however it is not creating a unique timeline from the overlapping timestamp.

If you look at the table, the actual "downtime" for resource 1 on 4th February across four instances is only 5 minutes (as all the time stamp for resource 1 on 4th Feb is repeating between 3.35 pm and 3.40 pm, however, the result is showing 20 minutes which is misleading for the manager as they are coming in the dashboard to identify the "Lost Productivity" due to application outage. Actual DowntimeActual DowntimeResult MeasureResult Measure

Hi, @Anonymous 

 

I am  sorry for the late reply. Could you show us what the expected result is like? 

 

Best Regards

Allan

 

 

Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Only use the Start Time and End Time, so the number is slightly different from the difference, 

Vera_33_0-1613717486076.png

 

M solution:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("zZPNqsIwEIVfRboWnEwyUbMT3blTXImLIkEL17a01ee3PyJmUivFe/VCFp1Twvkmc2a7DVY2T87Z3g5EMAxmafoT7cMiSuK6BhyBGiGgGAgykjxJQSWBATKgy8/1ObXZJcqTrL6/sGmYFScbF3U5P9o4DqPK6NBou+G/JsCvE8iPE+DLKagWCW8EYJBcAnQJsD+BPwXVIsk7gZy8SyAZgfLsiBNoQ/VghAFZHpdAugSyP4Hf8F8TKEbAYzc2NPGl6X0KguVAuQRVuVk+M6cX7fvmKJrklb3j2FuDXuaameuenUN3/pg5dj8737XuznXz97eeneUe0dt9LE1vu69Es4QP5uSaU3vqdlc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, #"App Category" = _t, #"Start Time" = _t, #"End Time" = _t, Difference = _t, Supervisor = _t, Department = _t, Location = _t, #"Resolved by" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Employee", type text}, {"App Category", type text}, {"Start Time", type datetime}, {"End Time", type datetime}, {"Difference", type time}, {"Supervisor", type text}, {"Department", type text}, {"Location", type text}, {"Resolved by", type text}}),
    #"Inserted Date" = Table.AddColumn(#"Changed Type", "Date", each DateTime.Date([Start Time]), type date),
    #"Sorted Rows" = Table.Sort(#"Inserted Date",{{"Start Time", Order.Ascending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"Employee", "Date"}, {{"allrows", each _, type table [Employee=nullable text, App Category=nullable text, Start Time=nullable datetime, End Time=nullable datetime, Difference=nullable time, Supervisor=nullable text, Department=nullable text, Location=nullable text, Resolved by=nullable text, Date=date]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [a=Table.AddIndexColumn([allrows],"Index",0,1),
b=Table.ExpandRecordColumn(
  Table.AddColumn(
   a,
    "MaxTime",
    (OT) =>
      Table.Max(
        Table.SelectColumns(
          Table.SelectRows(a, (IT) => IT[Index] <= OT[Index]),
          "End Time"
        ),
        "End Time"
      )
  ),
  "MaxTime",
  {"End Time"},
  {"MaxTime"}
),
c=Table.AddColumn(
  b,
  "Break",
  each [
    x = try b[Start Time]{[Index] + 1} - [MaxTime] otherwise 0,
    y = Duration.From( if Number.From(x) > 0 then x else 0)
  ][y]
)][c]),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Downtime", each List.Max([Custom][End Time])- List.Min([Custom][Start Time])-Duration.From( List.Sum([Custom][Break]))),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"allrows", "Custom"})
in
    #"Removed Columns"

 

DAX solution:

calculated column

Break = 
VAR CurEmployee = overlap[Employee]
VAR CurDate = overlap[Date]
VAR CurrentTime = overlap[Start Time]
VAR PreviousMax =
    CALCULATE (
        MAX ( overlap[End Time] ),
        FILTER (overlap, overlap[Start Time] < CurrentTime && overlap[Date]=CurDate&&overlap[Employee]=CurEmployee)
    )
VAR MaxTime =
    COALESCE( PreviousMax, [End Time])
VAR Break =
    IFERROR(DATEDIFF(MaxTime,CurrentTime,SECOND),0)
RETURN
    IF(Break<0,0,Break)

 

measure 

Downtime = 
VAR Totalsecs = DATEDIFF(MIN(overlap[Start Time]),MAX(overlap[End Time]),SECOND) - SUM(overlap[Break])
VAR Hours = INT(Totalsecs/3600)
VAR Mins = INT((Totalsecs-Hours*3600)/60)
VAR Secs = Totalsecs-Hours*3600-Mins*60
RETURN
Hours&":"&Mins&":"&Secs

 

 

Anonymous
Not applicable

Thanks for this solution Vera, I am testing this solution and would share update with you shortly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors