Skip to content
Data & Databases

Status x Audience Cross-Tabulation with Marginal Totals

9 nodes 55 8 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local workflow that builds a two-dimensional cross-tab counting occurrences for every (Status, Audience) pair from a JSON array, computing row totals, column totals, the grand total, and a count of skipped invalid items, then routes pairs above a zero-count threshold to a separate branch and merges both branches into one output with no external calls or credentials.

How it works

  1. 1.Run the manual trigger; a Code node emits 10 fictional items (9 valid + 1 invalid).
  2. 2.The matrix builder cleans values, counts each pairing, computes marginals and grand total, skipping incomplete items.
  3. 3.A Set node adds pair_label while keeping all fields.
  4. 4.An IF node separates pairs with count > 0 from zero-count pairs.
  5. 5.Each branch enters an append Merge on its own input, then a no-op endpoint.

Use cases

  • Report sent/failed/queued message counts per audience segment
  • Any cross-tab aggregation of two configurable categorical fields
  • Spot segments that received zero of a given status via the zero branch

Requirements

  • No credentials; everything runs locally
  • To change the two fields edit STATUS_FIELD and AUDIENCE_FIELD in the matrix Code node
  • To use real data remove the generator node and connect your source

Setup and testing in n8n

  1. Import the JSON into n8n and execute from the manual trigger
  2. Verify 6 output pairs whose counts sum to 9, matching valid input items
  3. Verify the one zero pair (Failed × Individuals) arrives via merge input 1
  4. Try empty or field-missing input to see edge handling

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code Set If No Op Merge

Details

Trigger Manual trigger
Nodes 9
Apps 6
Views 55
Downloads 8

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (9)

/

Manual Trigger

Manual Trigger

#1

Generate Sample Messages

Code

#2

Build Cross-Tab Matrix

Code

#3

Format Pair Label

Set

#4

Count Above Zero?

If

#5

Active Pairs Path

No Op

#6

Zero Count Path

No Op

#7

Append All Branches

Merge

#8

Final Output

No Op

#9

Stage 1 - Sample Data

Sticky Note

#10

Stage 2 - Cross-Tab

Sticky Note

#11

Stage 3 - Routing

Sticky Note

#12
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime