Aller au contenu

Leçon 24 · Projects and Reference

KNIME Project: Monthly Sales Report Workflow

Build a complete KNIME project that reads orders and customers, cleans and joins them, checks data quality, summarizes revenue, and writes an Excel report.

Now you combine everything into a realistic workflow. Every Monday you receive an orders export and a customer list, and your manager wants revenue by region and month, a chart, and a list of problem rows. Build it in your own KNIME installation. The stand-ins below let you check the logic first.

The brief

Inputs (create them yourself as CSV files):

TEXT
orders.csv
order_id,order_date,customer_id,status,amount
1,2026-10-03,C1,paid,120.00
2,2026-10-15,C2,paid,80.00
3,2026-11-02,C1,cancelled,50.00
4,2026-11-09,C9,paid,60.00
5,2026-11-12,C2,paid,
5,2026-11-12,C2,paid,
6,2026-11-20,C3,paid,200.00

customers.csv
customer_id,region
C1,North
C2,South
C3,North

Rules: only paid orders count. A missing amount is a data problem, not zero. Exact duplicate rows are removed. Orders with an unknown customer go to the problem list.

The design

flowchart LR
  A["Read orders"] --> B["Remove duplicates"]
  B --> C["Keep paid"]
  C --> D["Join customers"]
  D --> E["Split good and bad"]
  E --> F["GroupBy region, month"]
  F --> G["Pivot and chart"]
  E --> H["Problem list"]

Good rows become the report, and bad rows are kept for review.

Step by step

  1. Read both files with CSV Reader nodes using paths relative to the workflow. Set customer_id to text and amount to a decimal.
  2. Deduplicate orders with Duplicate Row Filter on all columns. Note how many rows were removed.
  3. Filter to status = paid with Row Filter.
  4. Check that customer_id is unique in the customer table, using GroupBy with a count.
  5. Join orders to customers with a Joiner in left outer mode, so no order disappears.
  6. Split rows with a missing region or missing amount into the problem output.
  7. Derive a month column from order_date after converting it to a date type.
  8. Summarize with GroupBy: group by region and month, sum the amount, and count orders.
  9. Pivot months into columns for the report table, and add a Bar Chart of revenue by region.
  10. Write the summary and problem list to separate sheets with Excel Writer, with the report month in the file name.

Stand-in: the whole pipeline in SQL

Use this to find the expected answers before you build the nodes.

SQL Stand-in: the report logic in SQL

Press Run (or Ctrl + Enter) to see the result here.

You should find two problem rows (orders 4 and 5). The report totals are 400 across North and South: North 120 in October and 200 in November, South 80 in October.

Reconcile the result

Prove nothing vanished. Every paid, deduplicated order must end up either in the report or in the problem list:

Python Stand-in: reconciliation counts

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

In KNIME, compare the row counts at these three points. You can also build a check that stops the run if they do not match.

Make it reusable

  • Replace the report month in file names with a flow variable.
  • Package the cleaning steps as a component.
  • Add tests using this small dataset as golden data.
  • Add annotations that describe the rules, including who approved them.

Stretch goals

  1. Add a percentage change from the previous month for each region.
  2. Write one file per region with a loop.
  3. Build a dashboard component with a region selector.
  4. Add a rule that stops the run if more than 20% of paid orders have problems.

Before sending any real report, have someone else check the totals against the source system. Remove customer names and other personal details unless the audience needs them.

Expected results

Before you compare outputs, write your expectations down. With the data in the brief, there are seven order rows, one of which is an exact duplicate, so six unique orders remain. One of those is cancelled, so five paid orders remain. Two of them are problems: order 4 has an unknown customer, and order 5 has no amount. The three good orders are 1, 2, and 6.

Stage Expected rows
Raw orders 7
After duplicate removal 6
Paid only 5
Good rows 3
Problem rows 2

Check each number in the node monitor as you build. If one differs, stop at the first mismatch and investigate. Likely causes are a duplicate filter that compares the wrong columns, a status value with a stray space, and a customer_id read with different types in the two files.

Testing the failure paths

A project is not done when the happy path works. Try these changes one at a time and predict the result first:

  1. Add a second row for customer C1 in the customer file. Your uniqueness check should flag it before the join multiplies rows.
  2. Change a status to PAID in capital letters. Decide whether your workflow normalizes case, and make the answer visible.
  3. Delete the amount column. The workflow should fail with a clear message, not produce an empty report.
  4. Add a date from a different year. Check that your month column keeps years apart.

For each change, record what happened and what you fixed. This list becomes the seed of your test suite.

Presenting the report

The finished workbook should explain itself. Put the report month and the date it was produced on the first sheet, along with the rules that were applied. Show the totals first, then the detail. State how many rows are on the problem list, even when it is zero, so readers know the check ran. If problems exist, say that the totals exclude them, because a reader who compares your figure with the source system will otherwise assume your report is wrong. A short, honest note builds more trust than a clean-looking page that hides gaps.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. Why use a left outer join from orders to customers in this project?

    A left join keeps every order, so unmatched customers can be listed as problems.
  2. 2. How should a missing amount be treated under the project rules?

    The rules say a missing amount is a data problem.
  3. 3. What does the reconciliation check confirm?

    The counts show that no orders were silently lost.

Summary

  • Define inputs, rules, and expected results before building.
  • Keep problem rows visible rather than dropping them.
  • Check key uniqueness before joining.
  • Reconcile counts from source to report.
  • Add variables, components, and tests to make the workflow reusable.

Next: Project: Customer Churn Classifier

Votre progression est enregistrée dans ce navigateur. Aucun compte nécessaire.