JSON Occurrence Counter with Percentage Report and 20% Threshold Gate
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.Run the workflow manually from Run Report (Manual)
- 2.A Code node emits 12 fictional test items (10 valid + 1 empty value + 1 missing field)
- 3.Aggregate Counts & Percentages tallies counts, computes percentages, sorts descending
- 4.A Set node formats fields (value, count, percentage, rank, threshold) retaining other fields
- 5.IF routes each row to Dominant (>20%) or Minor branch
- 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
- Import the JSON into n8n and run Execute Workflow manually
- Verify final report: total_items=12, sum_of_counts=12, sum_of_percentages=100
- Edge case: empty the sample node or pass empty input and confirm the safe empty report
- 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
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (9)
Sticky: Overview & Setup
Sticky Note
Sticky: Threshold & Validation Rules
Sticky Note
Run Report (Manual)
Manual Trigger
Emit Sample Payload
Code
Aggregate Counts & Percentages
Code
Format Report Row
Set
Above 20 Percent Gate
If
Dominant Values
No Op
Minor Values
No Op
Join Report Branches
Merge
Build Final Report
Code
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