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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Csalinas144
Helper II
Helper II

Need to calcualte the turnaround days by Process Step and by Team Member

I am trying to transform this data to calculate the Turnaround days. I tried to copy the query two times to groupby the Min and Max date for Prject and Process step. But after merging it back into the original table the Min and Max values were incorrectly showing.

I need some guidance. 

Thank You,

 

Christian S.

 

Project NameProject Start DateProject Stop DateProcess StepProcess Step Assigned toCompletd ByTurnaround Days (Overall)Turnaround Days by Process StepTurnaround Days by Team
23451/3/20231/31/2023AInitiator Step1/6/2023 12:2128complete date - start date(3.5 days) 
23451/3/20231/31/2023BTeam 11/30/2023 10:3928process step A Max complete date - Min Complete DateTeam complete date minus previous Team complete Date (23.9 days)
23451/3/20231/31/2023CTeam 21/30/2023 10:4128  
23451/3/20231/31/2023DTeam 31/30/2023 10:4128  
23451/3/20231/31/2023DTeam 21/30/2023 10:4428  
23451/3/20231/31/2023ETeam 41/30/2023 12:5328  
23451/3/20231/31/2023ETeam 31/30/2023 13:1428  
23451/3/20231/31/2023FTeam 51/30/2023 13:1428  
23451/3/20231/31/2023FTeam 61/31/2023 8:0828  
23451/3/20231/31/2023FTeam 71/31/2023 8:0828  
35421/3/20233/13/2023AInitiator Step1/3/2023 15:0769  
35421/3/20233/13/2023BTeam 11/20/2023 14:1769  
35421/3/20233/13/2023CTeam 21/20/2023 15:2869  
35421/3/20233/13/2023DTeam 81/20/2023 15:2869  
35421/3/20233/13/2023DTeam 91/20/2023 15:2869  
35421/3/20233/13/2023DTeam 102/2/2023 10:1369  
 

 

3542
1/3/20233/13/2023DTeam 22/2/2023 10:1369  
35421/3/20233/13/2023DTeam 22/2/2023 10:1369  
35421/3/20233/13/2023DTeam 23/3/2023 12:2369  
35421/3/20233/13/2023ETeam 113/4/2023 11:0669  
35421/3/20233/13/2023ETeam 83/9/2023 14:3669  
35421/3/20233/13/2023FTeam 53/9/2023 14:3669  
35421/3/20233/13/2023FTeam 63/9/2023 14:3669  
35421/3/20233/13/2023FTeam 63/13/2023 9:3369  
35421/3/20233/13/2023FTeam 63/13/2023 9:3369  
35421/3/20233/13/2023FTeam 73/13/2023 9:3369 

 

 

22 REPLIES 22
Csalinas144
Helper II
Helper II

please indicate the expected outcome based on your sample data

 

Hello @lbendlin 

Here is the data

ProjectProject Start DateStepActionAction Assigned ToAction Date CompletedTurn Around Days (Step)Turn Around Days (Action Assigned To)
1003-JanA1Team 13-Jan20
1003-JanA2Team 25-Jan22
1003-JanB3Team 311-Jan106
1003-JanB4Team 413-Jan108
1003-JanB5Team 515-Jan1010
1003-JanC6Team 624-Jan159
1003-JanC7Team 730-Jan1515
10125-JanA1Team 126-Jan101
10125-JanA2Team 230-Jan115
10125-JanA3Team 35-Feb1111
10125-JanB4Team 47-Feb32
10125-JanB5Team 510-Feb35
10125-JanC6Team 610-Feb50
10125-JanC7Team 714-Feb54
10125-JanC8Team 815-Feb55
       The actions in the next step can not be worked unless all the actions in the previous step are completed

Step Turn Around Time

Summary:

The process Steps (A-C) are part of a project. The next step can not be completed until all of the actions are completed for the previous step. (The time that the process starts for A is the Project Start Date)

note that this step turnaround time will be repeating due to the action item is the lowest level in the heiarchy.

 

How I got 10 is I subtracted Jan 15 from Jan 5. where Jan 15th is the last day in step completed B and Jan 5th is the last step completed in setp A. Result is the total turnaround day from Last Step in Step A and Last Step in B. 

The idea Is that when the last action in the previous step is completed. the next step's timer is going to begin. 

 

Action Turn Around

Summary

 

I am calculating the Action Turnaround time by subtracting the Completed date of the Action from the previous action from the completed date of the current action I am calculating for. The first action turnaround time is calculated from the project start date.

 

Thank You, 

 

Chris.

 

@AlienSx @lbendlin 

@Csalinas144 I was asking about the first line of project 101 with step A and action completed - Jan 26th. I though that step days of this line should be the same for all other actions of step A (2 of them below are 11). For some reason it is 10 and I can't figure out why

You caught the error in that. Yes it should be 10.

 

@AlienSx 

@Csalinas144 another question: project 101, step B. Why step days = 3? It's 2nd step of the project, should be "end of step B" - "end of step A" = "10-Feb" - "5-Feb" = 5. It works in project 100, this is what you explained earlier. Why 101 is so different? 

ProjectProject Start DateStepActionAction Assigned ToAction Date CompletedTurn Around Days (Step)Turn Around Days (Action Assigned To)
1003-JanA1Team 13-Jan20
1003-JanA2Team 25-Jan22
1003-JanB3Team 311-Jan106
1003-JanB4Team 413-Jan108
1003-JanB5Team 515-Jan1010
1003-JanC6Team 624-Jan159
1003-JanC7Team 730-Jan1515
10125-JanA1Team 126-Jan101
10125-JanA2Team 230-Jan105
10125-JanA3Team 35-Feb1011
10125-JanB4Team 47-Feb32
10125-JanB5Team 510-Feb35
10125-JanC6Team 610-Feb50
10125-JanC7Team 714-Feb54
10125-JanC8Team 815-Feb55

Please refer to this one -

@AlienSx 

Please refer to updated table 

 

Thank You, 

 

Chris. 

@AlienSx 

@Csalinas144 In my view , your data are still inconsistent. Here is a code. I still can't get and explain your "3" in step B of project 101. 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fdG9CoQwEATgV5HUCtn8qK0eWFjbiYWC5d37l2aUlQu6WywZyEcWJvNsyFpTGl+N6y+dXRpKM+3rt6D7YinfoGOIEAXYIzNEIFJkYIlA0nLIyBKBpO2fNDVLBBcU2bBE8PZPogoXpZJcrdGsJv3VrKhYDfv2Jh9FNZrMi7ISfTSl06wqChptmbbXT510OQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [project = _t, start = _t, step = _t, action = _t, team = _t, completed = _t]),
    types = Table.TransformColumnTypes(Source,{{"completed", type date}, {"start", type date}}),
    gr_project = Table.Group(types, {"project"}, {{"gr_project", each _}}),
    // project processing function
    fx_project = (w as table) as table =>
        let 
            group = Table.Group(w, {"start", "step"}, {{"max_completed", each List.Max([completed]), type nullable date}, {"min_completed", each List.Min([completed]), type nullable date}, {"all", each _, type table [project=nullable text, start=nullable date, step=nullable text, action=nullable text, team=nullable text, completed=nullable date]}}),
            index = Table.AddIndexColumn(group, "idx", 0, 1, Int64.Type),
            // function for teams
            fx_ta_teams = (x as table, d as date) as table =>
                [a = Table.DuplicateColumn(x, "completed", "ta_teams"),
                b = Table.TransformColumns(a, {"ta_teams", (x) => Duration.Days(x - d) })][b],

            ta_step = 
                Table.AddColumn(
                    index, 
                    "ta_step", 
                    (x) => 
                        if x[idx] = 0 
                        then Duration.Days(x[max_completed] - x[min_completed])
                        else Duration.Days(x[max_completed] - index[max_completed]{x[idx] - 1})
                ),
            ta_teams = 
                Table.AddColumn(
                    ta_step, 
                    "all_teams",
                    (x) => 
                        if x[idx] = 0 
                        then fx_ta_teams(x[all], x[start])
                        else fx_ta_teams(x[all], ta_step[max_completed]{x[idx] - 1})
                ),
            cols = Table.SelectColumns(ta_teams,{"ta_step", "all_teams"}),
            expand = Table.ExpandTableColumn(cols, "all_teams", {"project", "start", "step", "action", "team", "completed", "ta_teams"}),
            reorder = Table.ReorderColumns(expand,{"project", "start", "step", "action", "team", "completed", "ta_step", "ta_teams"})
        in
            reorder,
    project_processing = Table.TransformColumns(gr_project, {"gr_project", fx_project}),
    combine = Table.Combine(project_processing[gr_project])
in
    combine

 

"3" is difference between Max Completed date of A and Max Completed date of B

 

@AlienSx 

Max Completed date of A  = 5-Feb (action 3)

Max Completed date of B = 10-Feb (action 5)

Max Date of B = Jan 15

Max Date of A = Jan 5

DIfference of 10 days

is it a joke? all this time I was talking about project 101. I am sorry, I give up. 

No, it is not. I apologize for the errors. The way it works for project 100 should have been the same for 101. Let me correct this with a clear mind. And reply back in a little bit.

 

Again I am sorry

 

Chris

B (Action 5) - A (Action 2) = 10 step turnaround for Step B

Hi, @Csalinas144 

this line:

10125-JanA1Team 126-Jan101

could you please explain how 10 is calculated? at the same time 2 next lines are 11

 

 

Please use the other data table. I corrected my mistake.

 

Thank You

 

Chris

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors