Analytics
  • Introductions
    • 👋Hello Analytics!
    • 👩‍🎓Workflow Philosophy
    • 📹Build a Workflow
    • 🖨️Start from a Template
      • 3 Way Match
      • Accounts Payable - Analytical Review
      • Accounts Payable - Debt Aging and Approval
      • Accounts Receivable - Analytical Review
      • Accounts Receivable - Completeness, Write-Offs, and Manual Adjustment Testing
      • Account Receivable - Credit Aging and Approval
      • Accounts Receivable - Credit Limits and Balance Testing
      • Account Reconciliation
      • Automated Sampling
      • Benford's Law
      • CutOff Testing
      • Change Management Review
      • Disbursement Analysis
      • Fictitious Vendor Testing
      • Financial Account Variance Analysis
      • Fixed Assets - Depreciation Recalculation
      • Fixed Assets - Duplicate Identification
      • Fixed Assets - Negative NBV Check
      • Journal Entries - Analytical Review
      • Journal Entries - Anomaly Detection
      • Journal Entries - Approval and Suspicious Posting Testing
      • Journal Entries - Balanced and Suspicious Amount Testing
      • Journal Entries - Duplicates and Sequence Testing
      • Missing Data Check
      • New User Access Testing
      • Numerical Outlier Detection
      • Payroll - Ghost Employees, Analysis, and Duplicates
      • Payroll - Inactivity and Salary Confirmation
      • Procure to Pay - Duplicates and Suspicious Posting Testing
      • Procure to Pay - Mismatched Documents & Vendor Spend
      • Procure to Pay - Payments Remitted to Employees
      • Procure to Pay - Payment Timing and Terms Test
      • Procure to Pay - Vendor Master File Review
      • Risk Scoring
      • Segregation of Duties
      • Terminated User Access Testing
      • Travel & Expense Testing
      • User Access Review
    • 📓Release Notes
  • Workflows
    • 🎨The Canvas
    • 📏Setting Up
    • 👆Drag & Drop
      • 🖱️Click to Add
    • 🧰Tools
    • 🧮Expression Builder
      • Operators
      • Functions
        • Aggregate Functions
          • AVERAGE
          • CORR
          • COUNT
          • COUNTD
          • COUNTBY
          • COUNTIF
          • COUNTIFS
          • COVAR
          • COVARP
          • COVARS
          • MAX
          • MEDIAN
          • MIN
          • MAXBY
          • MINBY
          • PERCENTILE
          • RUNNINGTOTALBY
          • SIGN
          • SIN
          • SQRT
          • SQUARE
          • STDEV
          • STDEVP
          • STDEVS
          • SUM
          • SUMBY
          • SUMIF
          • TAN
          • VAR
          • VARP
          • VARS
          • ZN
        • Conversion Functions
          • TIMESTAMPTODATE
          • TODATE
          • TODECIMAL
          • TOINT
        • Date/Time Functions
          • DATEADD
          • DATEDIF
          • DATENAME
          • DATENORMALIZE
          • DATEPART
          • DATETRUNC
          • DAY
          • DAYS
          • WORKDAYS
          • HOUR
          • ISDATE
          • ISOWEEKDAY
          • ISOWEEK
          • ISOQUARTER
          • ISOYEAR
          • MAKEDATE
          • MAKEDATETIME
          • MINUTE
          • MONTH
          • NOW
          • QUARTER
          • SECOND
          • TODAY
          • WEEK
          • WEEKDAY
          • YEAR
        • Logical Functions
          • AND
          • BETWEEN
          • CASE
          • CHOOSE
          • CONTAINSWITHIN
          • IF
          • IFS
          • IIF
          • IN
          • IFNULL
          • ISBOOLEAN
          • ISDECIMAL
          • ISDURATION
          • ISINTEGER
          • ISNULL
          • ISNUMBER
          • ISSTRING
          • ISUNIQUE
          • NOT
          • NULL
          • OR
          • SWITCH
          • ALL
            • TOSTRING
          • ANY
        • Math Functions
          • ABS
          • ACOS
          • ASIN
          • ATAN
          • ATAN2
          • CEILING
          • COS
          • COT
          • COSEC
          • DEGREES
          • DIV
          • EVEN
          • EXPONENTIAL
          • FILLINFINITY
          • FLOOR
          • HAVERSINE
          • LOG
          • LN
          • ODD
          • MODULO
          • PERCENTILEOFVALUE
          • PERCENTILEVALUE
          • PI
          • POWER
          • RADIANS
          • RANDOM
          • ROUND
          • SEC
        • Table Functions
          • ENCODE
          • INDEX
          • INDEXBY
          • FILLNULL
          • FIRSTBY
          • GENERATEUNIQUEID
          • LASTBY
          • LOOKUP
          • MATCH
          • NTH
          • OFFSET
          • OFFSETBY
          • PREVIOUSVALUE
          • RANK
          • RANKBY
          • RECORDID
          • ROLLINGAVERAGE
          • ROW
          • RUNNINGAVERAGE
          • RUNNINGMAX
          • RUNNINGMIN
          • RUNNINGSTDEV
          • RUNNINGTOTAL
          • WINDOWAVERAGE
          • WINDOWMAX
          • WINDOWMIN
          • WINDOWCOUNT
          • WINDOWSUM
          • SEQUENCE
          • WINDOWMEDIAN
          • WINDOWSTDEV
          • WINDOWSTDEVP
          • WINDOWSTDEVS
          • WINDOWVAR
          • WINDOWVARP
          • WINDOWVARS
          • WINDOWCORR
          • WINDOWCOVAR
          • WINDOWCOVARP
          • WINDOWCOVARS
          • SMOOTHEDAVERAGE
        • Text Functions
          • ASCII
          • CHAR
          • CONCAT
          • CONTAINS
          • ENDSWITH
          • FIND
          • FINDNTH
          • ISEMPTY
          • JSONPARSE
          • LEFT
          • LENGTH
          • LOWER
          • LTRIM
          • MID
          • PROPER
          • RIGHT
          • RTRIM
          • SPACE
          • SPLIT
          • STARTSWITH
          • TRIM
          • SUBSTITUTE
          • UPPER
        • Window Functions
    • 🔗Parameters
      • File Input Parameters
      • Sample Tool Parameters
      • System Parameters
  • Tools
    • 🗃️Import
      • Import File
      • Import From API
      • Import From Integration
        • GitHub
        • Snowflake
      • Import Sample Data
      • New Table
    • ✨Clean
      • Find Replace
      • ParseJSON
      • Sample
      • Text to Columns
      • Validate
    • 💻Code
      • PythonCode
        • Fuzzy Match
    • 🤝Merge
      • Append
      • Join
    • 🧙Transform
      • Edit Columns
      • Add Columns
      • Select Columns
      • Filter
      • Sort
      • Deduplicate
      • Pivot
      • Unpivot
    • 📊Visualize
      • Chart
        • Bar
        • Line
        • Combo
        • Scatter
        • Histogram
        • Box
        • Pie
        • Area
        • Funnel
    • 📬Publish
      • Publish to Toolkit
      • Publish via Email
  • 📚Dictionary
Powered by GitBook
On this page
  • What are window functions?
  • Why are window functions helpful?
  • Window Functions Available

Was this helpful?

  1. Workflows
  2. Expression Builder
  3. Functions

Window Functions

Last updated 1 year ago

Was this helpful?

What are window functions?

Window functions enable users to perform calculations against partitions (i.e. subgroups or sections) of a table. Unlike traditional aggregation functions, window functions partition the table behind the scenes and perform calculations against each partition instead of the entire table.

Why are window functions helpful?

Let's say that we have a list of populations for each state, broken out by region. If we use SUM to add up the population, we'd get the total for the whole column:

Here, we still add up our Adult Population but we segment by Region. So for each state, we list its region's total population.

Window Functions Available

Many functions are accompanied by their window function equivalents, which perform the same function but on partitioned tables. Generally, window functions take one additional argument, the column on which to partition. Window functions available:

Function
Description

[`RANKBY`](../functions/table/rankby.md)

Rank values within a group

[`SUMBY`](../functions/aggregate/sumby.md)

Total values within a group

[`OFFSETBY`](../functions/table/offsetby.md)

Find adjacent values within a group

[`COUNTBY`](../functions/aggregate/countby.md)

Count the non-null values within a group

But what if we wanted to sum the population for each region? In that case, we'd want my new column to contain the total for region each state is in. For that, instead of using SUM, we'd use the alternative window function :

🧮
SUMBY