- DAX Functions Tutorial
- DAX Functions - Home
- DAX Functions - Introduction
- DAX Parameter Naming Conventions
- Description Structure
- DAX Functions - Aggregation
- DAX Functions - Filter
- DAX Functions - Time Intelligence
- DAX Functions - Date and Time
- DAX Functions - Information
- DAX Functions - Logical
- Math & Trigonometric Functions
- DAX Functions - Parent & Child
- DAX Functions - Statistical
- DAX Functions - Text
- DAX Functions - Other
- DAX Functions Useful Resources
- DAX Functions - Quick Guide
- DAX Functions - Useful Resources
- DAX Functions - Discussion
DAX Filter - EARLIER function
Description
Returns the current value of the specified column in an outer evaluation pass of the mentioned column.
Syntax
EARLIER (<column>, <number>)
Parameters
Sr.No. | Parameter & Description |
---|---|
1 |
column A column or expression that resolves to a column. |
2 |
number Optional. A positive number to the outer evaluation pass.
If omitted, default value is 1. |
Return Value
The current value of row, from column, at number of outer evaluation passes.
Remarks
EARLIER is useful for nested calculations where you want to use a certain value as an input and produce calculations based on that input. In Microsoft Excel, you can do such calculations only within the context of the current row. However, in DAX you can store the value of the input and then make calculation using data from the entire table.
EARLIER is mostly used in the context of calculated columns. EARLIER succeeds if there is a row context prior to the beginning of the table scan. Otherwise, it returns an error.
Example
If you have a table Sales with sales data, you can create a calculated column with the ranks of the Sales Amount values as follows −
= COUNTROWS ( FILTER (Sales, EARLIER (Sales[Sales Amount])<Sales[Sales Amount]) )+1