Skip to content
Data & Databases

JSON Occurrence Counter with Percentage Report and 20% Threshold Gate

9 nodes 58 6 Manual trigger
Download

Loading workflow…

Workflow Description

Fully local workflow that counts occurrences of each distinct item_value in a JSON payload, computes each value's percentage of the total rounded to two decimals, and sorts rows descending by count. An IF node splits rows above a strict 20% threshold from the rest without dropping any row, and both branches are re-joined into one final Code node that builds a single summary report verifying that the sum of counts equals the input count and percentages total 100% within a declared tolerance. Missing, empty, or non-string values are bucketed as (missing), with type validation before trim/lowercase.

How it works

  1. 1.Run the workflow manually from Run Report (Manual)
  2. 2.A Code node emits 12 fictional test items (10 valid + 1 empty value + 1 missing field)
  3. 3.Aggregate Counts & Percentages tallies counts, computes percentages, sorts descending
  4. 4.A Set node formats fields (value, count, percentage, rank, threshold) retaining other fields
  5. 5.IF routes each row to Dominant (>20%) or Minor branch
  6. 6.Merge rejoins branches and Build Final Report builds ONE report verifying totals

Use cases

  • Analyzing dominant values in local JSON logs or categories
  • Distribution report of document/request types before further integrations
  • Separating high-frequency categories for downstream n8n processing

Requirements

  • n8n 2.45.5 (Manual Trigger, Code, Set, If, Merge, NoOp, Sticky Note)
  • No credentials or API calls — local processing only
  • To replace sample data: delete Emit Sample Payload and connect a real source with the same item_value schema

Setup and testing in n8n

  1. Import the JSON into n8n and run Execute Workflow manually
  2. Verify final report: total_items=12, sum_of_counts=12, sum_of_percentages=100
  3. Edge case: empty the sample node or pass empty input and confirm the safe empty report
  4. Change the threshold in the IF node and Build Final Report and rerun to test both branches

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 58
Downloads 6

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)

/

Sticky: Overview & Setup

Sticky Note

#1

Sticky: Threshold & Validation Rules

Sticky Note

#2

Run Report (Manual)

Manual Trigger

#3

Emit Sample Payload

Code

#4

Aggregate Counts & Percentages

Code

#5

Format Report Row

Set

#6

Above 20 Percent Gate

If

#7

Dominant Values

No Op

#8

Minor Values

No Op

#9

Join Report Branches

Merge

#10

Build Final Report

Code

#11
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