Forum Discussion

DukeAHolics's avatar
DukeAHolics
Regular Visitor
3 years ago

Method to Sum Totals Per Team Up To Maximum

Friends,

 

I have provided a simple sample dataset which essentially mirrors my data sample (just much smaller) in the first 3 columns with the 4th column an example of what I'm trying to automate. The teams can produce a total of 2 job lengths per day and they may touch multiple jobs per day totaling more than 2. I would like to show how much of each job each team will complete up to the full 2, and not over 2. Essentially, I want to sum the total job length for each team until I get to 2 or greater, then the last job should be the difference. If there is only one assigned job and it is greater than or equal to 2, it would just be "2". The column "Shift Job Length" is a sample of my desired outcome. Thoughts? Thank you!

 

TeamTeam AssignmentTotal Job LengthShift Job Length
Team 1.11.12.12
Team 2.12.10.20.2
Team 2.22.20.40.4
Team 2.32.31.91.4
Team 3.13.11.81.8
Team 3.23.22.00.2
Team 4.14.10.10.1
Team 4.24.20.20.2
Team 4.34.30.30.3
Team 4.44.40.20.2
Team 4.54.50.20.2
Team 4.64.61.41

1 Reply

  • DukeAHolics , Try a new column

     

    New Column =
    VAR _TA = 'Table'[Team Assignment]
    VAR _JL = 'Table'[Total Job Length]
    VAR _CL =
    calculate(
    sum('Table'[Total Job Length]),
    filter(
    'Table',
    'Table'[Team Assignment] = _TA
    && 'Table'[Total Job Length] <= EARLIER(_JL)
    )
    )
    return
    IF(
    _CL >= 2,
    _JL - (_CL - 2),
    _JL
    )