After its first few weeks with Kanban, the Support & Platform team has the feeling that things are going better: fewer open items, fewer interruptions, customers getting answers. But a feeling is not enough to commit to a timeframe with Customer Service or to tell Elena Campos when the migration will be finished. For that, the team needs flow metrics: objective measures of how much work is in the system, how much is delivered, and how long it takes. In this lesson you will learn to define lead time, cycle time, throughput, work in progress, and work item age precisely; to relate them through Little's Law and its assumptions; to read a cumulative flow diagram (CFD) and a cycle time scatterplot with its percentiles; to set a Service Level Expectation (SLE); and to make a first probabilistic forecast with Monte Carlo. You will do it with small Python programs that calculate everything from a CSV file containing the data of Raúl Ortega's team.

  1. Why Measure Flow

In Kanban Principles and Practices you saw that the customers of Raúl's service were not mainly asking for speed, but for predictability: Rosa Méndez wants to be able to tell a customer when they will get an answer, and Elena wants to know whether the migration will be done on time. Flow metrics serve three purposes:

Use Question it answers Example
Diagnose Where and why does the work get stuck? Items wait longer in Verification than in any other column
Commit What timeframe can we offer with confidence? "85% of standard requests are resolved in 9 days or less"
Forecast When will we finish a body of work? "With 85% probability, the migration will be done on or before September 3"

Flow metrics measure the system, not people. Using them to compare or evaluate individuals would destroy their reliability: people would start moving cards to "look good," and the data would stop describing reality.

  1. Precise Definitions

2.1. The Moments That Are Recorded

All flow metrics depend on a few moments in the life of each item. On the board of Raúl's team, which you designed in The Kanban Board, they are these:

flowchart LR
    A[Created<br/>arrives in Intake] --> C[Committed<br/>enters Ready]
    C --> E[Delivered<br/>enters Delivered]
  • Created: the moment the request is logged in Intake.
  • Committed: the moment it crosses the commitment point (enters Ready).
  • Delivered: the moment it crosses the delivery point (enters Delivered).

2.2. The Five Metrics

Metric Definition Unit
Lead time Time elapsed between two defined points in the flow. In the Kanban Method it is usually measured from the commitment point to the delivery point; if it is measured from when the request is made, it is called customer lead time Days
Cycle time In the Kanban Guide, the time elapsed between when a work item starts and when it finishes, according to the team's Definition of Workflow Days
Throughput Number of items finished per unit of time Items per day or per week
WIP (work in progress) Number of items started and not finished at a given moment Items
Work item age For an item that has not finished yet, the time elapsed from when it started until now Days

2.3. The Naming Problem

The terms lead time and cycle time are used in different ways depending on the source, the tool, or the company. What the Kanban Method calls system lead time (commitment → delivery) matches what the Kanban Guide calls cycle time if the team defines an item as "starting" at the commitment point. Some tools use cycle time for the time from when someone starts actively working on an item. There is no universally "correct" way: what is essential is to define it in writing and not change it.

Raúl's team recorded its definitions like this:

# Measurement definitions - Support & Platform
start: committed                  # entry into Ready
end: delivered                    # entry into Delivered
metrics:
  lead_time: "from created to delivered"       # what the customer experiences from the moment they ask
  cycle_time: "from committed to delivered"    # how long the system takes once committed
  wip: "items committed and not delivered"
  age: "from committed to today, for whatever is in progress"
unit: calendar_days
convention: "if it starts and ends on the same day, it counts as 1 day"
  • start and end are the two pieces of information the Kanban Guide requires in the Definition of Workflow. By using the commitment point as the start, the team's cycle time matches the Kanban Method's system lead time.
  • lead_time is reserved for the customer's view, which includes the time in Intake. It is the most relevant one for Rosa, but it depends partly on how Intake is ordered, which is not always in the team's hands.
  • unit: calendar_days avoids a common source of errors: mixing calendar days and working days in the same calculation.
  • convention: if an item is committed and delivered on the same day, its time is 1 day, not 0. That is why the calculations add 1 to the difference between dates. It is a common convention that avoids zero-day times.

  1. The Team's Data: A CSV File

During the first two weeks, with the physical board, dates were recorded irregularly. From the third week on, the digital board records every move. That is why Raúl analyzes the period from Monday, April 27 to Friday, May 22, 2026: four weeks, 26 calendar days. He exported to a CSV (comma-separated values) file the items from the lanes that had activity during that period:

id,type,class,created,committed,delivered
SP-118,incident,standard,2026-04-14,2026-04-20,2026-04-28
SP-121,request,standard,2026-04-16,2026-04-21,2026-04-29
SP-123,maintenance,intangible,2026-04-08,2026-04-22,2026-05-08
SP-124,migration,standard,2026-03-30,2026-04-22,2026-05-04
SP-126,incident,standard,2026-04-20,2026-04-23,2026-04-30
SP-127,improvement,standard,2026-04-02,2026-04-24,2026-05-06
SP-130,incident,expedite,2026-04-27,2026-04-27,2026-04-27
SP-131,request,standard,2026-04-22,2026-04-27,2026-05-04
SP-132,incident,standard,2026-04-23,2026-04-27,2026-05-05
SP-133,migration,standard,2026-03-30,2026-04-28,2026-05-08
SP-134,maintenance,fixed_date,2026-04-20,2026-04-28,2026-05-07
SP-135,request,standard,2026-04-28,2026-04-29,2026-05-04
SP-136,incident,standard,2026-04-29,2026-04-30,2026-05-07
SP-137,improvement,standard,2026-04-15,2026-05-04,2026-05-14
SP-138,incident,standard,2026-05-04,2026-05-04,2026-05-08
SP-139,request,fixed_date,2026-04-30,2026-05-05,2026-05-12
SP-140,incident,expedite,2026-05-06,2026-05-06,2026-05-07
SP-141,migration,standard,2026-03-30,2026-05-05,2026-05-15
SP-142,incident,standard,2026-05-05,2026-05-06,2026-05-13
SP-143,request,standard,2026-05-06,2026-05-07,2026-05-12
SP-144,maintenance,intangible,2026-04-10,2026-05-07,2026-05-21
SP-145,incident,standard,2026-05-07,2026-05-08,2026-05-14
SP-146,improvement,standard,2026-04-28,2026-05-11,2026-05-18
SP-147,migration,standard,2026-03-30,2026-05-11,2026-05-19
SP-148,request,standard,2026-05-08,2026-05-11,2026-05-14
SP-149,incident,standard,2026-05-11,2026-05-12,2026-05-18
SP-150,incident,standard,2026-05-12,2026-05-12,2026-05-15
SP-151,request,standard,2026-05-11,2026-05-13,2026-05-20
SP-152,incident,expedite,2026-05-14,2026-05-14,2026-05-14
SP-153,maintenance,standard,2026-05-06,2026-05-14,2026-05-21
SP-154,migration,standard,2026-03-30,2026-05-15,2026-05-22
SP-155,incident,standard,2026-05-14,2026-05-15,2026-05-20
SP-156,request,standard,2026-05-15,2026-05-18,2026-05-21
SP-157,incident,standard,2026-05-18,2026-05-18,2026-05-22
SP-158,improvement,standard,2026-05-05,2026-05-19,2026-05-22
SP-159,migration,standard,2026-03-30,2026-05-19,
SP-160,incident,standard,2026-05-18,2026-05-19,
SP-161,request,standard,2026-05-19,2026-05-20,
SP-162,maintenance,intangible,2026-04-24,2026-05-11,
SP-163,incident,standard,2026-05-20,2026-05-20,
SP-164,improvement,standard,2026-05-12,2026-05-21,
SP-165,request,fixed_date,2026-05-18,2026-05-21,
SP-166,incident,standard,2026-05-21,2026-05-21,
SP-167,incident,standard,2026-05-07,2026-05-08,
SP-168,request,standard,2026-05-20,,
SP-169,improvement,intangible,2026-05-14,,
SP-170,request,standard,2026-05-13,,
SP-171,improvement,intangible,2026-05-15,,
SP-172,incident,standard,2026-05-19,,
SP-173,request,standard,2026-05-21,,
SP-174,improvement,standard,2026-05-22,,

How to read the file:

  • The first line is the header: the name of each column. Each subsequent line is an item.
  • type and class are the type of work and the class of service you already know. They are written in lowercase without spaces (request, fixed_date) to avoid problems when processing them.
  • Dates follow the year-month-day format, which sorts correctly and which Python reads directly.
  • An empty field means that the moment has not happened yet: SP-159 to SP-167 are committed but not delivered (they are the current WIP), and SP-168 to SP-174 are in Intake, uncommitted.
  • The migration tasks were all created on March 30, when the 22-task plan was logged.
  • Some numbers are missing (SP-119, SP-120...): those are items delivered before the period or discarded.

  1. Calculating the Basic Metrics with Python

4.1. A Shared Utilities Module

To avoid repeating code in every program, Javier created a small module, data.py, with the functions all the others will use:

import csv
import math
from datetime import date

START = date(2026, 4, 27)    # first day of the analysis period (Monday)
TODAY = date(2026, 5, 22)    # last day of the analysis period (Friday)

def days(start, end):
    # Convention: if it starts and ends on the same day, it counts as 1 day
    return (end - start).days + 1

def percentile(values, p):
    # Nearest rank: the smallest value that has at least p % of the data
    # at or below it
    ordered = sorted(values)
    position = math.ceil(p / 100 * len(ordered))
    return ordered[position - 1]

def read_tasks(path="support_tasks.csv"):
    with open(path, encoding="utf-8") as f:
        tasks = list(csv.DictReader(f))
    for t in tasks:
        for field in ("created", "committed", "delivered"):
            t[field] = date.fromisoformat(t[field]) if t[field] else None
    return tasks

def delivered_in_period(tasks):
    return [t for t in tasks
            if t["delivered"] and START <= t["delivered"] <= TODAY]

Explanation:

  • START and TODAY delimit the analysis period. They are written in uppercase because they are constants that do not change during execution.
  • days(start, end) subtracts two dates (the result is a time interval, whose .days attribute gives the number of days) and adds 1, following the agreed convention.
  • percentile(values, p) sorts the values and returns the one at position p %. For example, with 20 values, the 85th percentile is the one at position ceil(0.85 × 20) = 17: at least 17 of the 20 values (85%) are equal to it or lower. math.ceil rounds up. This is the nearest-rank method, simple and without interpolation; other tools may use slightly different methods and produce somewhat different values when there is little data.
  • read_tasks opens the CSV and uses csv.DictReader, which turns each line into a dictionary whose keys are the header names (t["created"], t["class"]...). It then converts the date strings into date objects with date.fromisoformat, or into None if the field is empty.
  • delivered_in_period filters the items whose delivery date falls within the period.

4.2. The Metrics Program

from datetime import timedelta
from data import START, TODAY, days, percentile, read_tasks, delivered_in_period

def group(t):
    # Migration is analyzed separately; everything else, by class of service
    return "migration" if t["type"] == "migration" else t["class"]

tasks = read_tasks()
delivered = delivered_in_period(tasks)
for t in delivered:
    t["lead_time"] = days(t["created"], t["delivered"])
    t["cycle_time"] = days(t["committed"], t["delivered"])
num_days = days(START, TODAY)

# 1. Throughput
throughput = len(delivered) / num_days
print(f"Period: {START} to {TODAY} ({num_days} days)")
print(f"Delivered: {len(delivered)} -> average throughput {throughput:.2f} per day")
monday = START
while monday <= TODAY:
    sunday = monday + timedelta(days=6)
    n = sum(1 for t in delivered if monday <= t["delivered"] <= sunday)
    print(f"  week of {monday}: {n}")
    monday += timedelta(days=7)

# 2. Lead time and cycle time
lt = [t["lead_time"] for t in delivered if group(t) != "migration"]
ct = [t["cycle_time"] for t in delivered]
print(f"\nAverage lead time (excluding migration): {sum(lt) / len(lt):.1f} days")
print(f"Average cycle time (all items):          {sum(ct) / len(ct):.1f} days")

# 3. Cycle time by group
print("\nCycle time by group:    n  mean  p50  p85")
p85_by_group = {}
for g in ["expedite", "fixed_date", "standard", "intangible", "migration"]:
    v = [t["cycle_time"] for t in delivered if group(t) == g]
    p85_by_group[g] = percentile(v, 85)
    print(f"  {g:<18} {len(v):>3} {sum(v) / len(v):6.1f} "
          f"{percentile(v, 50):>4} {p85_by_group[g]:>4}")

# 4. Average daily WIP and a check of Little's Law
daily_wip = []
d = START
while d <= TODAY:
    daily_wip.append(sum(1 for t in tasks if t["committed"]
                         and t["committed"] <= d
                         and (t["delivered"] is None or t["delivered"] >= d)))
    d += timedelta(days=1)
average_wip = sum(daily_wip) / len(daily_wip)
print(f"\nAverage observed WIP:            {average_wip:.1f}")
print(f"Throughput x average cycle time: {throughput * sum(ct) / len(ct):.1f}")

# 5. Age of the items in progress, compared with their group's p85
in_progress = [t for t in tasks if t["committed"] and not t["delivered"]]
print(f"\nIn progress at the end of {TODAY}: {len(in_progress)}")
for t in sorted(in_progress, key=lambda t: t["committed"]):
    age = days(t["committed"], TODAY)
    limit = p85_by_group[group(t)]
    warning = "  <-- above its group's p85" if age > limit else ""
    print(f"  {t['id']}  {group(t):<11} age {age:>2} (p85 {limit:>2}){warning}")

Explanation, block by block:

  • group(t) decides how to group each item. Migration tasks are standard class, but they have a different size and their own lane, and mixing them with the incidents would distort the results: they are analyzed separately.
  • First, for each delivered item, the program calculates its lead_time (created → delivered) and its cycle_time (committed → delivered), storing them in the dictionary itself.
  • Block 1, throughput: divides the delivered items by the number of days in the period, and then counts deliveries per week. timedelta(days=6) adds six days to each Monday to get the Sunday.
  • Block 2: calculates the averages. Lead time is calculated without the migration, because all its tasks were created at the same time on March 30 and their time in Intake reflects the plan, not a customer's wait.
  • Block 3: for each group, how many items there are (n), the mean, and the 50th and 85th percentiles. It stores each group's 85th percentile in the p85_by_group dictionary for use in block 5.
  • Block 4: walks through the period day by day and counts how many items were committed and not delivered. An item counts as WIP every day between its commitment and its delivery, both included, consistent with the add-1 convention. It then compares the average WIP with the product of throughput and average cycle time (you will understand why in section 5).
  • Block 5: for each item in progress, calculates its age and compares it with its group's 85th percentile. sorted(..., key=lambda t: t["committed"]) orders them from oldest to newest.

The output:

Period: 2026-04-27 to 2026-05-22 (26 days)
Delivered: 35 -> average throughput 1.35 per day
  week of 2026-04-27: 4
  week of 2026-05-04: 11
  week of 2026-05-11: 9
  week of 2026-05-18: 11

Average lead time (excluding migration): 12.9 days
Average cycle time (all items):          7.7 days

Cycle time by group:    n  mean  p50  p85
  expedite             3    1.3    1    2
  fixed_date           2    9.0    8   10
  standard            23    7.2    8    9
  intangible           2   16.0   15   17
  migration            5   10.4   11   13

Average observed WIP:            11.1
Throughput x average cycle time: 10.4

In progress at the end of 2026-05-22: 9
  SP-167  standard    age 15 (p85  9)  <-- above its group's p85
  SP-162  intangible  age 12 (p85 17)
  SP-159  migration   age  4 (p85 13)
  SP-160  standard    age  4 (p85  9)
  SP-161  standard    age  3 (p85  9)
  SP-163  standard    age  3 (p85  9)
  SP-164  standard    age  2 (p85  9)
  SP-165  fixed_date  age  2 (p85 10)
  SP-166  standard    age  2 (p85  9)

4.3. What the Numbers Say

  • Throughput: 35 items in four weeks, about 10 a week once things stabilized. The first week had only 4 deliveries: it included the May 1 holiday and was the week of the switch to the digital board, when much of the committed work had only just started.
  • Lead time vs. cycle time: on average, a customer waits 12.9 days from asking for something to receiving it. The average cycle time of those same items (without the migration) is about 7.3 days, and that of all items, 7.7. The difference, a little over 5 days, is the time spent in Intake. For Rosa, this is an important finding: part of her customers' wait is not in the team's work, but in the queue before commitment.
  • Classes of service: expedite items are resolved in 1 or 2 days, as expected. Standard work, which makes up the majority (23 items), takes 7.2 days on average and 9 days or less in 85% of cases. Groups with 2 or 3 items have too little data to draw firm conclusions.
  • WIP: the team has had about 11 committed items on average, a far cry from the 34 in March.
  • Age: SP-167 has been in progress for 15 days, when 85% of standard items are finished in 9 or fewer. This is a warning sign that, without this calculation, might have gone unnoticed. Raúl will look into it at the next daily meeting (you will see this in Implementing Kanban in Projects).

Notice that age is the only one of these metrics that looks at work in progress: cycle time is only known once an item finishes, when it is too late to act on it. That is why the Kanban Guide insists on monitoring work item age.

  1. Little's Law

5.1. Statement

Little's Law, proven by John D. C. Little in 1961 in the field of queuing theory, relates the three quantities of flow. Applied to a Kanban system, it is stated as follows:

Average WIP = average throughput × average cycle time

Or, solving for cycle time:

Average cycle time = average WIP / average throughput

This second form explains why limiting WIP works: if the team maintains its throughput and reduces its average WIP, the average cycle time has to go down.

5.2. Checking It Against the Team's Data

The program calculated both sides:

  • Average observed WIP: 11.1 items.
  • Average throughput × average cycle time: 1.35 items/day × 7.7 days ≈ 10.4 items.

The two values are similar, but not identical. Part of the difference is because WIP grew slightly during the period (from 6 to 9 items; see the assumptions table), and part is due to edge effects: the 9 items still in progress at the end (including SP-167, at 15 days) add to WIP every day but are not included in the average cycle time calculation, because they have not finished yet; and some items delivered at the beginning were committed before April 27. The longer the period and the more stable the system, the closer the two values get.

5.3. The Assumptions

Little's Law only holds when certain conditions are met. Daniel Vacanti, one of the authors of the Kanban Guide, summarizes them for flow systems as follows:

Assumption What it means Does it hold in the period analyzed?
Balanced arrivals and departures The average rate at which work is committed equals the average rate at which it is delivered Roughly: 38 commitments and 35 deliveries in the period
Everything that goes in comes out Committed work ends up delivered (or is recorded if it is discarded) Yes: nothing committed was discarded
Similar WIP at the start and at the end The system is neither filling up nor emptying out Roughly: 6 items at the start of the period and 9 at the end
Stable average age The average age of the WIP is not consistently increasing or decreasing Roughly; SP-167 is an exception to keep an eye on
Consistent units All quantities in the same units Yes: calendar days throughout

5.4. Correct and Incorrect Uses

  • Correct use: understanding the system ("if we reduce WIP from 11 to 8 while maintaining throughput, the average cycle time should drop to about 8 / 1.35 ≈ 5.9 days") and checking whether the system is stable (if the two sides of the equation drift apart, an assumption is being broken).
  • Incorrect use: forecasting when a specific item will finish. The law talks about averages, and averages hide a lot of variation: one item can take 2 days and another 13. To forecast, you use percentiles and simulations, as you will see in sections 7 to 9.

  1. The Cumulative Flow Diagram (CFD)

6.1. What It Is

The cumulative flow diagram (CFD) shows, for each day, how many items have already passed through each point in the flow. Each line is cumulative: it never goes down. When the lines are drawn one above the other, the space between them forms bands, one per state.

6.2. How to Calculate It

from datetime import timedelta
from data import START, TODAY, read_tasks

tasks = read_tasks()

def cumulative(field, day):
    # How many items had already passed that point by the end of the day
    return sum(1 for t in tasks if t[field] and t[field] <= day)

print("day         arrived  committed  delivered | intake  in progress")
day = START
while day <= TODAY:
    if day.weekday() < 5:                      # working days only
        arr = cumulative("created", day)
        com = cumulative("committed", day)
        dlv = cumulative("delivered", day)
        print(f"{day}  {arr:>7} {com:>10} {dlv:>10} | {arr - com:>6} {com - dlv:>12}")
    day += timedelta(days=1)

print("\nChart (# delivered, = in progress, . in Intake):")
for day in [START + timedelta(days=7 * i) for i in range(4)] + [TODAY]:
    arr, com, dlv = (cumulative(c, day) for c in ("created", "committed", "delivered"))
    print(f"{day} " + "#" * dlv + "=" * (com - dlv) + "." * (arr - com))
  • cumulative(field, day) counts how many items have that moment (created, committed, or delivered) recorded on or before day. That is the definition of "cumulative."
  • The loop goes through the working days (weekday() < 5: from Monday, 0, to Friday, 4) and prints the three cumulative lines and, on the right, the width of the bands: intake (arrived minus committed) and in progress (committed minus delivered, that is, the WIP at the end of the day).
  • The final part draws a text bar chart for five dates: # for each delivered item, = for each item in progress, and . for each item in Intake. It is a CFD "lying on its side": time moves downward.
  • A clarification: the CSV only contains items with activity during the period, so the cumulative lines start at low values. What matters in a CFD is not the absolute value, but the width of the bands and the slope of the lines.

The output:

day         arrived  committed  delivered | intake  in progress
2026-04-27       18          9          1 |      9            8
2026-04-28       20         11          2 |      9            9
2026-04-29       21         12          3 |      9            9
2026-04-30       22         13          4 |      9            9
2026-05-01       22         13          4 |      9            9
2026-05-04       23         15          7 |      8            8
2026-05-05       25         17          8 |      8            9
2026-05-06       28         19          9 |      9           10
2026-05-07       30         21         12 |      9            9
2026-05-08       31         23         15 |      8            8
2026-05-11       33         27         15 |      6           12
2026-05-12       35         29         17 |      6           12
2026-05-13       36         30         18 |      6           12
2026-05-14       39         32         22 |      7           10
2026-05-15       41         34         24 |      7           10
2026-05-18       44         36         26 |      8           10
2026-05-19       46         39         27 |      7           12
2026-05-20       48         41         29 |      7           12
2026-05-21       50         44         32 |      6           12
2026-05-22       51         44         35 |      7            9

Chart (# delivered, = in progress, . in Intake):
2026-04-27 #========.........
2026-05-04 #######========........
2026-05-11 ###############============......
2026-05-18 ##########################==========........
2026-05-22 ###################################=========.......

6.3. How to Read a CFD

flowchart TB
    A[Vertical width of a band] --> A1[How many items are in that state<br/>the In progress band is the WIP]
    B[Horizontal distance between two lines] --> B1[Roughly how long items take<br/>between those points]
    C[Slope of the delivered line] --> C1[Throughput: the steeper it is<br/>the more is delivered]
What you see What it means
Bands of constant width and parallel lines A stable system: work comes in and goes out at the same rate
A band that widens More work enters that state than leaves it: WIP grows and, by Little's Law, cycle time will grow
A band that narrows until it almost disappears The state is emptying; if it is a work stage, it may run out of work
A flat delivered line for several days Nothing is being delivered: a blocker, a holiday, or batch deliveries
A delivered line in steps Deliveries grouped in batches instead of a continuous flow

In the team's CFD:

  • The in progress band fluctuates between 8 and 12 items, with no sustained upward trend: the system is stable, and the WIP limits are working.
  • The Intake band stays between 6 and 9: the demand coming in is similar to what the team commits to.
  • The delivered line is flat between April 30 and May 1 (holiday) and between May 8 and May 11 (weekend), and its slope increases from May 4 onward, when the flow stabilized.
  • The widenings of the in-progress band to 12 items (May 11 to 13 and May 19 to 21) coincide with weeks in which several items were committed in a row. Making sure they do not become a trend is part of managing the flow.

With a digital tool or a spreadsheet, the CFD is drawn as a stacked area chart; you read it the same way.

  1. Cycle Time Scatterplot and Percentiles

7.1. Why Percentiles and Not Averages

The average cycle time for standard work is 7.2 days, but if Rosa promises a customer "7 days," she will be wrong almost half the time: the average says nothing about variation. Percentiles do:

  • 50th percentile (median): half of the items take that long or less.
  • 85th percentile: 85% of the items take that long or less. It is a confidence level widely used in Kanban for committing to timeframes.
  • 95th percentile: almost all of them; useful when the cost of missing is high.

7.2. The Scatterplot

A cycle time scatterplot draws one point for each finished item: on the horizontal axis, the day it was delivered; on the vertical axis, its cycle time. Horizontal lines are drawn over it at the percentiles.

from data import START, TODAY, days, percentile, read_tasks, delivered_in_period

# Standard items in the Operations swimlane only (no migration)
standard = [t for t in delivered_in_period(read_tasks())
            if t["class"] == "standard" and t["type"] != "migration"]

points = {}                                    # (column, row) -> number of items
for t in standard:
    x = (t["delivered"] - START).days          # day of the period (0 = April 27)
    y = days(t["committed"], t["delivered"])   # cycle time in days
    points[(x, y)] = points.get((x, y), 0) + 1

cycle_times = [days(t["committed"], t["delivered"]) for t in standard]
p50, p85 = percentile(cycle_times, 50), percentile(cycle_times, 85)
width = (TODAY - START).days + 1

for y in range(max(cycle_times), 0, -1):
    row = ""
    for x in range(width):
        n = points.get((x, y), 0)
        if n:
            row += str(n)                      # how many items fall on that point
        elif y == p85:
            row += "-"                         # 85th percentile line
        elif y == p50:
            row += "."                         # 50th percentile line
        else:
            row += " "
    label = "  <- p85" if y == p85 else ("  <- p50" if y == p50 else "")
    print(f"{y:>3} | {row}{label}")
print("    +" + "-" * (width + 1))
print("      4/27      5/7       5/17 5/22  (delivery date)")
  • Only standard items in the Operations lane are selected, because they are the ones that will share a common service expectation. Mixing expedite items or migration tasks into the same chart would produce percentiles that are useful for none of the groups.
  • The points dictionary counts how many items fall on each position: x is the number of days since April 27; y, the cycle time.
  • The outer loop goes through the rows from top to bottom (range(max(cycle_times), 0, -1) counts backward), because the top row is printed first on screen.
  • At each position, the program prints the number of items that fall there; if there are none, it draws the line for the corresponding percentile (- for the 85th, . for the 50th) or a space.
  • The last two lines draw the horizontal axis and a few reference dates.

The output:

 13 |          1
 12 |
 11 |                  1
 10 |
  9 | -11-----1-----------------  <- p85
  8 | ...1...1..1.....1....1.11.  <- p50
  7 |                  1   1
  6 |        1       1       1
  5 |            1             1
  4 |                  11     11
  3 |
  2 |
  1 |
    +---------------------------
      4/27      5/7       5/17 5/22  (delivery date)

How to read it:

  • Each number is the count of items delivered that day with that cycle time. For example, the 11 at the start of row 9 indicates one item on April 28 and another on April 29 (including SP-118, whose journey you followed in the previous lesson), both at 9 days.
  • The median is 8 days and the 85th percentile is 9. Of the 23 items, 21 are on or below the 85th percentile line, and only 2 are above it (11 and 13 days).
  • There is no visible trend: the May points are no higher than those from late April. If the points rose over time, it would indicate that the system is getting worse.
  • Points far above the 85th percentile deserve a question: what happened to them? The 13-day one (SP-127) was an improvement that was blocked for several days while waiting for a customer to test the result.

  1. The Service Level Expectation (SLE)

8.1. What It Is

The Kanban Guide defines the Service Level Expectation (SLE) as a forecast of how long it should take a work item to flow from start to finish. It has two parts: a period of time and a probability. For example: "85% of items are finished in 9 days or less."

Three important characteristics:

  • It is an expectation, not a contract: it describes how the system behaves, not a penalty.
  • It is based on historical data (usually a cycle time percentile), not on wishful thinking.
  • It is useful while the item is in progress: by comparing an item's age with the SLE, the team knows whether it is at risk of missing it and needs attention.

8.2. The SLE for Raúl's Team

With the data from the four weeks, the team proposed the following at the service delivery review:

# Service Level Expectation - Support & Platform (May 2026)
sle:
  - applies_to: "standard items in the Operations lane"
    expectation: "85% in 9 days or less from commitment"
    basis: "23 items delivered from Apr 27 to May 22"
    review: "monthly, or sooner if the system changes"
pending:
  expedite: "little data (3 items); provisional target: 2 days or less"
  fixed_date: "managed by its date; commit with a margin over the SLE"
  intangible: "no SLE"
  migration: "managed with a forecast for the whole project, not per item"
  • expectation has the two parts required by the Kanban Guide: the time (9 days) and the probability (85%).
  • basis records the data used. With 23 items, the SLE is reasonable but provisional: that is why it is reviewed monthly.
  • pending shows that not every group needs an SLE: with little data or a different kind of commitment, it is more honest not to make one up.

How it is used day to day:

  • The SLE is posted on the board, next to the Operations lane.
  • In the daily meeting, any standard item whose age is approaching 9 days gets priority attention.
  • Rosa Méndez can tell customers: "In most cases, you'll have it within 9 days of when we accept it; if it's going to take longer, we'll let you know."
  • SP-167, at 15 days of age, has already exceeded the SLE: this is not a failure of the system, but exactly the kind of item the SLE helps to detect.

  1. Probabilistic Forecasting with Monte Carlo

9.1. Elena's Question

In Kanban Principles and Practices, Raúl committed to answering with data when the migration would be done. There are 16 tasks left of the 22 in the plan (including SP-159, in progress), and the contract with the current provider expires on September 30, 2026.

An answer like "16 tasks at 1.25 a week is about 13 weeks" uses an average and hides the variation. A Monte Carlo simulation makes it possible to answer in terms of probabilities.

9.2. The Idea

  1. Take the history of how many migration tasks were delivered on each working day of the period.
  2. Simulate the future day by day, picking a past day at random for each future day and assuming that the same amount gets delivered as on that day.
  3. Repeat until the 16 tasks are complete, and record how many days it took.
  4. Repeat thousands of times. The result is a distribution of possible finish dates, from which percentiles are obtained.

9.3. The Program

import random
from datetime import date, timedelta
from data import START, TODAY, percentile, read_tasks

HOLIDAYS = {date(2026, 5, 1)}
REMAINING = 16                        # migration tasks still to do
FORECAST_START = date(2026, 5, 25)    # Monday after the analysis
DEADLINE = date(2026, 9, 30)          # end of the contract with the current provider
SIMULATIONS = 10_000

def is_working_day(d):
    return d.weekday() < 5 and d not in HOLIDAYS

# 1. History: migration tasks delivered on each working day
tasks = read_tasks()
history = []
d = START
while d <= TODAY:
    if is_working_day(d):
        history.append(sum(1 for t in tasks if t["type"] == "migration"
                           and t["delivered"] == d))
    d += timedelta(days=1)
print(f"Working days observed: {len(history)}, "
      f"migration tasks delivered: {sum(history)}")

# 2. Simulation: how many working days it takes to finish
random.seed(42)                       # to always get the same result
results = []
for _ in range(SIMULATIONS):
    done, working_days = 0, 0
    while done < REMAINING:
        done += random.choice(history)     # a "random" day from the past
        working_days += 1
    results.append(working_days)

def date_after(n_working_days):
    d, counted = FORECAST_START, 0
    while True:
        if is_working_day(d):
            counted += 1
            if counted == n_working_days:
                return d
        d += timedelta(days=1)

# 3. Results
for p in (50, 85, 95):
    n = percentile(results, p)
    print(f"  {p}% probability of finishing on or before {date_after(n)}")
on_time = sum(1 for n in results if date_after(n) <= DEADLINE)
print(f"Probability of finishing by {DEADLINE}: "
      f"{100 * on_time / SIMULATIONS:.0f}%")

Explanation:

  • The constants at the top define the problem: 16 remaining tasks, the date from which the simulation starts, the deadline, and the number of simulations (10_000 is 10,000; the underscore just makes it easier to read).
  • is_working_day(d) returns True from Monday to Friday, except on holidays.
  • Block 1: builds the history list, with one number for each working day in the period: how many migration tasks were delivered that day. Most days are 0, and on five days it is 1.
  • Block 2: this is the simulation. random.choice(history) picks a past day at random; the program adds what was delivered that day and moves forward one working day, until the 16 tasks are complete. Each simulation produces a number of working days, which is stored in results. random.seed(42) fixes the seed of the random number generator so that the result is always the same and you can reproduce it; in real use you can leave it out.
  • date_after(n) converts a number of working days into a calendar date, counting from May 25 and skipping weekends.
  • Block 3: calculates the 50th, 85th, and 95th percentiles of the results, converts them into dates, and calculates what proportion of the simulations finish by September 30.

The output:

Working days observed: 19, migration tasks delivered: 5
  50% probability of finishing on or before 2026-08-13
  85% probability of finishing on or before 2026-09-03
  95% probability of finishing on or before 2026-09-17
Probability of finishing by 2026-09-30: 98%

9.4. How to Communicate It, and Why Not to Trust It Too Much

Raúl replied to Elena: "If we keep up the pace of these four weeks, there's an 85% probability of finishing the migration on or before September 3. Half of the simulations finish by August 13." Notice that he does not give a date, but a date with its probability.

But any simulation is only as good as its assumptions, and these ones matter:

  • Little history: 19 working days and 5 deliveries. Each new week of data will make the forecast more reliable; it has to be repeated regularly.
  • It assumes the future will resemble the past: the same team, the same level of dedication, and tasks of similar size. If the remaining tasks are more complex (for example, migrating the main database), the forecast will be optimistic.
  • Vacations: the simulation treats August like any other month. If Javier and Raúl, who are doing the migration, take their vacations in August, the pace will drop. Exercise 3 will ask you to quantify this.

These risks do not invalidate the forecast: they give it context. The natural place to deal with them is a regular risk review, which the team will set up in the next lesson.

  1. Flow Metrics and Scrum Metrics

María Ruiz's product team will also need to measure its progress. The metrics most associated with Scrum, such as velocity or burndown and burnup charts, are covered in Monitoring and Controlling Agile Projects. The flow metrics in this lesson are not exclusive to Kanban: many Scrum teams also measure the cycle time of their backlog items or the age of the items in the Sprint Backlog.

Common Mistakes and Tips

  • Not defining start and end. Without a written definition, everyone measures something different and the figures cannot be compared. Tip: write down the measurement definitions before collecting data.
  • Promising the average. The average is missed almost half the time. Use percentiles, such as the 85th, to make commitments.
  • Mixing very different types of work. Putting expedite items, improvements, and migration tasks into the same percentile produces a number that is useful to nobody. Group by class of service or by swimlane.
  • Looking only at what is finished. Cycle time arrives too late. Monitor the age of what is in progress so you can act in time.
  • Using Little's Law to forecast a specific item. It is a relationship between averages in a stable system; to forecast, use percentiles and Monte Carlo.
  • Turning metrics into individual targets. If "closing quickly" is rewarded, tickets will be closed quickly... whether or not they are resolved. Measure the system, never the people.
  • Trusting too little data. With 2 or 3 items, a percentile means nothing. Say "we don't have enough data yet" rather than making up a figure.

Exercises

Exercise 1: Calculating by Hand

Using the team's convention (add 1 day), calculate the lead time and cycle time of these items from the CSV: SP-130, SP-137, and SP-142. Then answer: if the team managed to reduce its average WIP to 8 items while keeping a throughput of 1.35 items per day, what would its average cycle time be according to Little's Law? What assumption would you need to check before trusting the result?

Exercise 2: Interpreting a CFD

Another Órbita team gets this table from its CFD (values at the end of each Friday):

Week Arrived Committed Delivered
1 20 12 5
2 32 22 9
3 45 33 12
4 57 44 14

Calculate the width of the "in progress" band each week, describe what is happening, and say what you would tell that team, using Little's Law.

Exercise 3: Monte Carlo with Vacations

Modify the Monte Carlo program to assume that the migration stops completely in August (Javier and Raúl on vacation at the same time). Run the program and compare the result with the original. What would you recommend to Raúl?

Solutions

Exercise 1

Item Created Committed Delivered Lead time Cycle time
SP-130 Apr 27 Apr 27 Apr 27 1 day 1 day
SP-137 Apr 15 May 4 May 14 30 days 11 days
SP-142 May 5 May 6 May 13 9 days 8 days
  • SP-130 is an expedite item: it was logged, committed, and delivered on the same day, so both times are 1 by convention.
  • SP-137 shows the difference between the two metrics: the improvement waited 19 days in Intake before being committed. For the customer it took 30 days, even though the system took 11.
  • Little's Law: average cycle time = average WIP / throughput = 8 / 1.35 ≈ 5.9 days.
  • Before trusting it, check above all that throughput holds when WIP is reduced (if lowering WIP left people unable to work on the bottleneck, throughput could drop) and that the system remains balanced (similar arrivals and departures). Typical mistake: forgetting to add the convention day, or mixing calendar days and working days.

Exercise 2

The "in progress" band (committed minus delivered) measures 7, 13, 21, and 30 items: it widens every week. The team commits about 10 or 11 items a week but delivers only between 2 and 4. According to Little's Law, if WIP grows and throughput does not, cycle time will keep growing: each new item will take longer than the one before. On top of that, the delivered line is getting flatter (from 4 to 3 to 2 per week), perhaps because the excess WIP is causing multitasking. Recommendation: limit WIP and stop committing work until the band stops growing, and investigate what is slowing down the deliveries.

Exercise 3

All it takes is adding two lines at the start of is_working_day:

def is_working_day(d):
    if d.month == 8:                  # August: the migration stops
        return False
    return d.weekday() < 5 and d not in HOLIDAYS
  • d.month == 8 is true for any day in August; by returning False, those days do not count as working days, either in the simulation or in the conversion to dates.
  • The history is not affected, because the observed period is in April and May.

Output:

Working days observed: 19, migration tasks delivered: 5
  50% probability of finishing on or before 2026-09-11
  85% probability of finishing on or before 2026-10-02
  95% probability of finishing on or before 2026-10-16
Probability of finishing by 2026-09-30: 82%

The probability of finishing on time drops from 98% to 82%, and the 85th percentile becomes October 2, after the contract expires. Recommendation: have Javier and Raúl stagger their vacations so the migration does not stop in August, move the riskiest tasks up to June and July, and repeat the forecast every month with the new data. It is a good example of how a probabilistic forecast turns a vague risk ("August is a bad month") into a concrete decision.

Conclusion

Flow metrics turn the feeling that "things are going better" into data you can use to diagnose, commit, and forecast. Lead time and cycle time measure the time between points in the flow that each team must define in writing; throughput measures how much is delivered; WIP, how much is in progress; and work item age, how long the unfinished items have been in progress, the only metric that lets you act in time. Little's Law relates average WIP, throughput, and cycle time, explains why limiting WIP reduces times, and holds only under certain assumptions. The CFD shows the stability of the system through the width of its bands and the slope of its lines; the scatterplot and percentiles describe the variation; the SLE turns it into an expectation that is useful to the customer; and Monte Carlo lets you answer "when?" with probabilities.

Raúl's team now has its first figures: about 10 items delivered per week, an average WIP of 11, an average cycle time of 7.7 days, an SLE of 9 days at 85% for standard work, an age alert on SP-167, and a migration forecast that looks comfortable... unless August grinds to a halt. What remains is to see how all of this fits into the team's normal way of working: which meetings sustain it, what went wrong in the first few weeks, and how it coordinates with María's product team. That is what you will see in the last lesson of the module, Implementing Kanban in Projects.

© Copyright 2026. All rights reserved