Cascade Library
  • Introduction
    • Welcome to Cascade
    • Workspaces
  • Getting Started
    • Build Your First Workflow
    • Build Your First Data App
  • Workflows
    • Overview
      • Navigating the Canvas
      • Setting Up
      • Drag and Drop
      • Tools
    • Dynamic Workflows
    • Global Variables
    • Data Locker
    • Scheduling
    • Webhooks
    • Run Logs
    • Workflow Deployment
  • Integrations
    • Connecting Cascade to your database
    • Amazon S3
    • Azure Blob Storage
    • BigQuery
    • Google Sheets
    • MySQL
    • Postgres
    • Redshift
    • SQL Server
    • Snowflake
    • Tableau Server
  • Tools
    • Import
      • Import File
      • Import from Data Locker
      • Import from API
      • Import Sample Data
      • New Table
    • Clean
      • Validate Schema
      • Find/Replace
      • Text to Columns
      • Flatten Json
      • Sample
      • Standardize
      • Validate
    • Transform
      • Edit Columns
      • Select Columns
      • Filter
      • Sort
      • Pivot
      • Unpivot
      • Deduplicate
    • Merge
      • Append
      • Join
      • Multi Join
      • Fuzzy Join
    • Predictive Modeling
      • Build Model
      • Apply Model
      • Correlate
      • ARIMA Forecast
    • Flow
      • Conditional
    • Code
      • Python
      • SQL
    • Visualize
      • Chart
        • Bar
        • Line
        • Combo
        • Scatter
        • Histogram
        • Box
        • Pie
        • Area
        • Funnel
    • Publish
      • Publish to Data Locker
      • Publish via Email
      • Publish to URL
      • Embed
  • Functions & Expressions
    • Functions
      • Aggregate Functions
        • AVERAGE
        • CORR
        • COUNT
        • COUNTD
        • COUNTBY
        • COUNTIF
        • COUNTIFS
        • COVAR
        • COVARP
        • COVARS
        • MAX
        • MEDIAN
        • MIN
        • MAXBY
        • MINBY
        • PERCENTILE
        • STDEV
        • STDEVP
        • STDEVS
        • SUM
        • SUMBY
        • SUMIF
        • VAR
        • VARP
        • VARS
        • RUNNINGTOTALBY
          • SIGN
          • SIN
          • SQRT
          • SQUARE
          • TAN
          • ZN
      • Conversion Functions
        • TIMESTAMPTODATE
        • TODATE
        • TODECIMAL
        • TOINT
      • Date/Time Functions
        • DATEADD
        • DATEDIF
        • DATENAME
        • DATENORMALIZE
        • DATEPART
        • DATETRUNC
        • DAY
        • DAYS
        • 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
    • Building Expressions
      • Expression Operators
      • Guide to Window Functions
  • Cascade FAQs
    • Best Practices
      • 💬How to add a total row to a table
      • 💬How to leave comments on a workflow
      • 💬How to add new columns in the Edit Columns tool
      • 💬Setting up a New Table tool
      • 💬How to rename a tool
    • Knowledge Based
      • 💬How to change Data Types in Cascade
      • 💬How to remove columns from a table in Cascade
      • 💬How to rename columns in Cascade
      • 💬Understanding the Join options in the Cascade Join tool
      • 💬How to connect tools to each other
    • Import
      • 💬How to Import an Excel File into Cascade
      • 💬How to Import a CSV File into Cascade
      • 💬How to import a CSV file into the Data Locker
    • Functions and Expressions
      • 💬How to write an IN() statement with multiple variables
      • 💬How to Remove null Records with a Filter tool
      • 💬How to write an IF Statement in Cascade
      • 💬How to replace null values with 0
    • Troubleshooting
      • ⚠️What does it mean if my workflow won’t load?
      • ⚠️Why can’t I connect my tool to other tools?
      • ⚠️Why are there duplicate records after my Join tool?
  • Change Log
On this page
  • What are window functions?
  • Why are window functions helpful?
  • Window Functions Available

Was this helpful?

  1. Functions & Expressions
  2. Building Expressions

Guide to Window Functions

Window functions partition a table before they run, making them very useful when working with large datasets

PreviousExpression OperatorsNextCascade FAQs

Last updated 4 years 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

Rank values within a group

Total values within a group

Find adjacent values within a group

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
RANKBY
SUMBY
OFFSETBY
COUNTBY