Top N Average


๐Ÿ“Š Top N Average Function

๐Ÿ” Definition

This function is used to:

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

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

โš™๏ธ Parameter

1. ๐ŸŽฏ Field

Fields to be averaged

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
After the process:
1. Average per category
    category        avg_views
    --------------------------
    Music           150
    Gaming          200
2. Top N (for example N=1)
    category_new    avg_views
    -------------------------
    Gaming          200

๐Ÿงช Case Study Examples

๐ŸŽฏ Case:

Displays the Top 3 YouTube categories with the most average views

๐Ÿ”„ Workflow ๐Ÿ“Š Output:
    category_new	avg_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.