सामग्री पर जाएँ

लेसन 24 · Projects and Reference

Project: Monthly Sales Pipeline

Build a complete Alteryx project that reads monthly sales files, cleans and joins them, rejects bad rows, summarizes results and checks control totals.

In this project you design a workflow that a company could run every month. Stores send sales files, a product table gives prices and categories, and managers want revenue by category and store. You will clean the data, keep rejected rows, summarize and verify.

All data here is made up. Build it in Designer with Text Input tools or CSV files, or follow the runnable stand-ins.

The requirements

Item Rule
Sales files One per month, same columns: store, sku, qty, sale_date
Product table sku, category, unit_price
Valid row Quantity above 0, known SKU, a parsable date
Output 1 Revenue by category and store
Output 2 Rejected rows with a reason
Checks Valid rows plus rejected rows equal input rows

Writing the rules first prevents arguments later. Ask the business who decides what to do with returns (negative quantities). Here they are rejected for review.

The design

flowchart LR
  F["Sales files"] --> C["Clean and convert"]
  C --> J["Join products"]
  P["Product table"] --> J
  J -->|J| V["Filter valid"]
  J -->|L| X["Rejects"]
  V -->|F| X
  V -->|T| S["Summarize"]

Every row ends up either in the summary or in the rejects.

Step by step

  1. Input. Read all monthly files with a wildcard or Directory plus Dynamic Input. Add the file name as a field. See input data.
  2. Clean. Trim and uppercase sku and store in both sources. Use Data Cleansing or a Formula.
  3. Convert. Make qty numeric and convert sale_date with the right date format.
  4. Check the lookup. Confirm that the product table has one row per SKU.
  5. Join on sku. The L output holds sales with an unknown SKU.
  6. Filter the J output for valid rows.
  7. Reason. Add a reject_reason field to each rejected stream, then Union the rejects.
  8. Revenue. Formula: [qty] * [unit_price].
  9. Summarize by category and store.
  10. Output both results, then check totals.

An expression for a reason on the filter's F side:

TEXT
IF IsNull([qty]) THEN "bad quantity"
ELSEIF [qty] <= 0 THEN "quantity not positive"
ELSEIF IsNull([sale_date_parsed]) THEN "bad date"
ELSE "other"
ENDIF

Stand-in for the whole pipeline

Python Stand-in: the full pipeline in Python

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.

The date 31/11/2026 is rejected because November has 30 days. That is the kind of row a real source can contain.

SQL view of the summary

SQL Stand-in: the summary step in SQL

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

Verification

Add a check branch:

  • Row accounting: count valid and rejected rows and compare with the input count.
  • Revenue: total of the summary equals total of the valid detail.
  • Lookup: a duplicate SKU in the product table must raise an error.
  • Empty input: the run stops with a clear message.

Use the Message and Test tools to make failed checks visible.

Stretch goals

  1. Add a month-over-month change with Multi-Row Formula.
  2. Create a Cross Tab with months as columns.
  3. Turn the month into an input of an analytic app.
  4. Package it and test it in a new folder.

Write a one-page handover note: purpose, inputs, rules, outputs, checks and how to rerun. Another person should be able to run the workflow without asking you.

Testing your build

Before you trust the pipeline, feed it a small input where you know every answer. The six rows in the stand-in are a good start. In your own workflow, compare these points:

Check Expected for the six sample rows
Valid rows 3
Unknown SKU rejects 1 (the Z9 row, from the Join L output)
Quantity rejects 1 (the negative quantity)
Date rejects 1 (31 November)
Total revenue 79.00

Then break the input on purpose. Add a second row for SKU A1 to the product table and watch the revenue grow. Your lookup check should catch this before anyone sees the report. Remove all sales rows and confirm that the run reports a clear problem instead of producing an empty report that looks normal. Rename the qty column in one monthly file and check that the problem is reported, however you read the files.

Questions for the business

A real project raises questions that no tool can answer. Should a return reduce revenue in the month of the sale or the month of the return? Which price applies if it changed in the middle of the month? What should happen to a sale with a future date? Record each answer with the name of the person who decided it.

Practice task

Add a second month of invented sales to the pipeline, with at least one new store and one category that has no sales this month. Predict the new summary by hand. Then run the workflow and compare.

Check that the new store appears, that the empty category is handled according to your rule and that row accounting still balances. Ask yourself how the report would look if the second file arrived twice under two different names. Design a check that detects this, for example by looking for identical contents or an unexpected jump in the row count, and decide whether it should stop the run.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. Why keep rejected rows in a separate output?

    Silently dropped rows make totals wrong and untraceable.
  2. 2. Why must the product table have one row per SKU?

    A repeated key on the lookup side duplicates matches and inflates revenue.
  3. 3. Which check proves no rows disappeared?

    Row accounting shows that every input row has a destination.

Summary

  • Define rules and outputs before building.
  • Clean keys, convert types, check the lookup and send every row somewhere.
  • Verify with row accounting and control totals.
  • Document the workflow so another person can run it.

Next: Project: Customer Deduplication

आपकी प्रगति इसी ब्राउज़र में सेव होती है। खाते की ज़रूरत नहीं है।