Top N Count


๐Ÿ“Š Top N Count Function

๐Ÿ” Definition

This function is used to:

โžก๏ธ Count the values โ€‹โ€‹of a field
โžก๏ธ Then take the N data with the largest count value

In other words:
    Aggregate + Automatic Ranking (Top N based on COUNT)

โš™๏ธ Parameter

1. ๐ŸŽฏ Field

Fields to be Counted

Example:

2. ๐Ÿ”ข Number of Record (N)

3. ๐Ÿ”€ Ordered (Y/N)

๐Ÿ“Œ Recommendation: use Y for clear results (Largest top)

๐Ÿ“ฅ Input & ๐Ÿ“ค Output

Input Output
The output will contain:

๐Ÿง  How it works

For example data:
    category        views
    ---------------------
    Music           100
    Music           200
    Gaming          300
    Gaming          100
    Gaming          50
After the process:
1. COUNT per category
    category        sum_views
    --------------------------
    Music           2
    Gaming          3
2. Top N (for example N=1)
    category_new    count_views
    -------------------------
    Gaming          3

๐Ÿงช Case Study Examples

๐ŸŽฏ Case:

Displays the Top 3 YouTube categories with the most count views

๐Ÿ”„ Workflow ๐Ÿ“Š Output:
    category_new	count_views
    -----------------------------
    Music               1000
    Gaming              900
    News                850

๐Ÿ’ก Important Note:

The useful output fields from this buffer function are the grouped fields and new fields. Add a Transformator () assembly afterward to select these fields.