Data Analysis Expressions
Data Analysis Expressions
DAX (Data Analysis Expressions) is a formula language used in Microsoft tools like Power BI, Power Pivot, and SSAS (SQL Server Analysis Services) to create
custom calculations and expressions on data models. It is designed to work with relational data and is used to define calculated columns, measures, and
custom tables.
1. Calculation Language: DAX is similar to Excel formulas but optimized for use in data modeling and analytics.
2. Functions: Includes a rich library of functions such as aggregation (SUM, AVERAGE), logical (IF, SWITCH), filtering (FILTER, CALCULATE), and time
intelligence (TOTALYTD, SAMEPERIODLASTYEAR).
3. Row Context and Filter Context: DAX uses contexts to evaluate expressions depending on the data structure and filters applied.
Applications of DAX:
In summary, DAX is essential for advanced data modeling and insightful analytics within the Microsoft data ecosystem.
Feature M Code (Power Query Formula Language) DAX (Data Analysis Expressions)
Purpose Used for data extraction, transformation, and loading Used for data modeling, calculations, and analytics
Execution Time Executes during the data load (ETL process) Executes during report viewing (after data load)
Environment Power Query Editor Power BI Data View, Report View, and Modeling View
Used For Data shaping, cleaning, filtering, merging Creating calculated columns, measures, KPIs
Performance Impact Affects refresh time and data load size Affects report responsiveness and interaction
Calculated Columns
Key Points:
Created Using DAX: You write DAX formulas that return a value for each row.
Uses Row Context: It calculates values based on the data in the same row.
Row Context in DAX refers to the current row that is being evaluated in a table. It allows DAX to perform calculations on a row-by-row basis.
Allows access to column values in the current row without needing explicit filters.
Does not automatically filter the rest of the model—unlike filter context.
🧠 Example:
TotalCost = Sales[UnitPrice] * Sales[Quantity]
Each row uses its own UnitPrice and Quantity because of row context.
Use row context when you need calculations done per row, such as creating new columns or row-wise logic inside iterators.
Useful For:
Concatenating values (e.g., [First Name] & " " & [Last Name])
Extracting parts of a field (e.g., year from date)
Example:
If you have a Sales table with Quantity and UnitPrice , you can create a calculated column for total revenue:
DAX
TotalRevenue = Sales[Quantity] * Sales[UnitPrice]
Use calculated columns when you need the result to be used in slicers, filters, or relationships.
4. The calculation can be done in Power Query (M code) before data load.
6. You are only summarizing or aggregating values, which is better done via measures.
7. The column is used temporarily and not needed permanently in the model.
Measures in Power BI
Measures are DAX formulas used to calculate aggregated values dynamically based on user interaction with the report (like filters, slicers, visuals). Measures
are not stored in the data model; instead, they are calculated on the fly.
Example:
Total Sales = SUM(Sales[Amount])
Storage Stored physically in the data model Not stored; calculated during report runtime
Evaluation Time Calculated when data is loaded or refreshed Evaluated dynamically during user interaction
Used For Row-level data, relationships, filters Aggregations, KPIs, and summary-level analysis
Performance Impact Increases data size More efficient for large datasets
Supports Row Context Yes No (but can use iterators like SUMX to simulate it)
Use Case If new column is needed for filter/slicing If summary/aggregated value is needed
Explicit
Created manually using DAX by the user in the data model. Total Sales = SUM(Sales[Amount])
Measure
Implicit Automatically created by Power BI when you drag a numeric field into a Dragging Sales[Amount] into a visual automatically
Measure visual (uses default aggregation like SUM, AVERAGE). creates SUM(Sales[Amount])
Note: Explicit measures are preferred in professional reports because they offer more control, reuse, and performance tuning.
⚡ Measures in Power BI
Quick Measures are predefined DAX calculations that you can create using a point-and-click interface—no need to manually write DAX formulas. Power BI
generates the DAX code for you based on the selections you make.
Key Features:
Example:
Power BI auto-generates:
Sales % of Total =
DIVIDE(
SUM(Sales[Amount]),
CALCULATE(SUM(Sales[Amount]), ALL(Sales))
)
Context in Power BI
In Power BI (and DAX), context is the environment in which a calculation happens.
Row context → deals with one row at a time (e.g., calculated columns, iterators like SUMX )
Filter context → deals with which data rows are visible when a calculation runs.
2. Filter Context
Filter context is all the filters that are applied before a calculation happens.
2. Report/page filters
5. Implicit filters from visuals → e.g., a column chart bar for “Product A” only considers rows where Product = “A”
Example
A 2023 100
A 2024 150
B 2024 200
If a slicer filters Year = 2024 → Filter context = “Year = 2024” → Result = 350
If a chart bar shows “Product A” and “Year = 2024” → Filter context = “Product = A” AND “Year = 2024” → Result = 150
Sales_2023 = CALCULATE(
SUM(Sales[Sales]),
Sales[Year] = 2023
)
Important Notes
Filter context can come from multiple places and stacks together (intersection of all filters)
REMOVEFILTERS()
ALL()
If you put on red-tinted glasses (filter for Product A), everything you see will be red (only Product A data is visible to the calculation).
If you also put on blue glasses at the same time (filter for Year 2024), the overlap might let through only purple light (only rows with Product A and Year 2024).
Row context → happens in calculated columns or iterators ( SUMX , FILTER ), moves one row at a time.
Example:
General pattern:
Syntax rules:
Table names are in single quotes if they contain spaces: 'Sales Table'
A. Arithmetic Operators
+ Addition 5 + 3 8
- Subtraction 10 - 4 6
* Multiplication 2 * 3 6
/ Division 10 / 2 5
^ Power 2 ^ 3 8
B. Comparison Operators
D. Logical Operators
` ` OR
1. ^ (power)
3. , / (multiplication/division)
4. + , (addition/subtraction)
6. NOT
7. && (AND)
8. || (OR)
Aggregation Functions
Function or
Syntax Example Use Cases
Formula
Function or
Syntax Example Use Cases
Formula
Returns leftmost
LEFT LEFT(text, num_chars) LEFT(Customer[Phone], 3)
characters from a string
Returns rightmost
RIGHT RIGHT(text, num_chars) RIGHT(Customer[Phone], 4)
characters from a string
Removes non-printable
CLEAN CLEAN(text) CLEAN(Customer[Notes])
characters
Converts text to
UPPER UPPER(text) UPPER(Customer[Name])
uppercase
Converts text to
LOWER LOWER(text) LOWER(Customer[Name])
lowercase
Function or
Syntax Example Use Cases
Formula
Function or
Syntax Example Use Cases
Formula
DAY DAY(date) DAY(Sales[OrderDate]) Returns the day of the month from a date
EDATE EDATE(start_date, months) EDATE(TODAY(), -3) Shifts a date by a given number of months
YEARFRAC(start_date,
YEARFRAC end_date, [basis])
YEARFRAC(DATE(2025,1,1), TODAY()) Returns fractional year between two dates
Filter Functions:
Function or
Syntax Example Use Cases
Formula
Returns a
table of
dates from
CALCULATE(SUM(Sales[SalesAmount]), the start of
DATESYTD DATESYTD(dates[, year_end_date])
DATESYTD(Sales[OrderDate])) the year to
the max
date in
context
Returns
dates from
CALCULATE(SUM(Sales[SalesAmount]), start of
DATESMTD DATESMTD(dates)
DATESMTD(Sales[OrderDate])) month to
max date
in context
Returns
dates from
CALCULATE(SUM(Sales[SalesAmount]), start of
DATESQTD DATESQTD(dates)
DATESQTD(Sales[OrderDate])) quarter to
max date
in context
Calculates
TOTALYTD(expression, dates[, TOTALYTD(SUM(Sales[SalesAmount]), YTD value
TOTALYTD filter][, year_end_date]) Sales[OrderDate]) for the
measure
Calculates
TOTALMTD(expression, dates[, TOTALMTD(SUM(Sales[SalesAmount]), MTD value
TOTALMTD filter]) Sales[OrderDate]) for the
measure
Function or Formula Syntax Example Use Cases
Calculates
TOTALQTD(expression, dates[, TOTALQTD(SUM(Sales[SalesAmount]), QTD value
TOTALQTD filter]) Sales[OrderDate]) for the
measure
Shifts dates
by given
number of
DATEADD(dates,
DATEADD number_of_intervals, interval)
DATEADD(Sales[OrderDate], -1, YEAR) intervals
(e.g., days,
months,
years)
Returns a
parallel
PARALLELPERIOD(dates,
PARALLELPERIOD number_of_intervals, interval)
PARALLELPERIOD(Sales[OrderDate], -1, YEAR) period in
the
past/future
Returns
dates from
same
SAMEPERIODLASTYEAR SAMEPERIODLASTYEAR(dates) SAMEPERIODLASTYEAR(Sales[OrderDate]) period in
the
previous
year
Returns
dates for
PREVIOUSYEAR(dates[,
PREVIOUSYEAR year_end_date])
PREVIOUSYEAR(Sales[OrderDate]) entire
previous
year
entire next
year
Returns
dates for
PREVIOUSMONTH PREVIOUSMONTH(dates) PREVIOUSMONTH(Sales[OrderDate]) entire
previous
month
Returns
dates for
NEXTMONTH NEXTMONTH(dates) NEXTMONTH(Sales[OrderDate])
entire next
month
Returns the
date for
PREVIOUSDAY PREVIOUSDAY(dates) PREVIOUSDAY(Sales[OrderDate]) the
previous
day
Returns the
date for
NEXTDAY NEXTDAY(dates) NEXTDAY(Sales[OrderDate])
the next
day
Returns
dates for
PREVIOUSQUARTER PREVIOUSQUARTER(dates) PREVIOUSQUARTER(Sales[OrderDate]) entire
previous
quarter
Returns
dates for
NEXTQUARTER NEXTQUARTER(dates) NEXTQUARTER(Sales[OrderDate])
entire next
quarter
Function or Formula Syntax Example Use Cases
Returns the
STARTOFYEAR(dates[, first date of
STARTOFYEAR STARTOFYEAR(Sales[OrderDate])
year_end_date]) the year in
context
Returns the
first date of
STARTOFMONTH STARTOFMONTH(dates) STARTOFMONTH(Sales[OrderDate])
the month
in context
Returns the
first date of
STARTOFQUARTER STARTOFQUARTER(dates) STARTOFQUARTER(Sales[OrderDate])
the quarter
in context
Returns the
ENDOFYEAR(dates[, last date of
ENDOFYEAR ENDOFYEAR(Sales[OrderDate])
year_end_date]) the year in
context
Returns the
last date of
ENDOFMONTH ENDOFMONTH(dates) ENDOFMONTH(Sales[OrderDate])
the month
in context
Returns the
last date of
ENDOFQUARTER ENDOFQUARTER(dates) ENDOFQUARTER(Sales[OrderDate])
the quarter
in context
Returns
CALCULATE(SUM(Sales[SalesAmount]), dates
DATESBETWEEN(dates, start_date,
DATESBETWEEN end_date)
DATESBETWEEN(Sales[OrderDate], DATE(2024,1,1), between a
DATE(2024,3,31))) start and
end date
Function or Formula Syntax Example Use Cases
Calculates
the value
CLOSINGBALANCEMONTH(expression, CLOSINGBALANCEMONTH(SUM(Sales[SalesAmount]),
CLOSINGBALANCEMONTH dates[, filter]) Sales[OrderDate]) at the end
of the
month
Calculates
the value
CLOSINGBALANCEQUARTER(expression, CLOSINGBALANCEQUARTER(SUM(Sales[SalesAmount]),
CLOSINGBALANCEQUARTER dates[, filter]) Sales[OrderDate]) at the end
of the
quarter
Calculates
CLOSINGBALANCEYEAR(expression, CLOSINGBALANCEYEAR(SUM(Sales[SalesAmount]), the value
CLOSINGBALANCEYEAR dates[, filter]) Sales[OrderDate]) at the end
of the year
Calculates
the value
OPENINGBALANCEMONTH(expression, OPENINGBALANCEMONTH(SUM(Sales[SalesAmount]),
OPENINGBALANCEMONTH dates[, filter]) Sales[OrderDate]) at the start
of the
month
Calculates
the value
OPENINGBALANCEQUARTER(expression, OPENINGBALANCEQUARTER(SUM(Sales[SalesAmount]),
OPENINGBALANCEQUARTER dates[, filter]) Sales[OrderDate]) at the start
of the
quarter
Calculates
OPENINGBALANCEYEAR(expression, OPENINGBALANCEYEAR(SUM(Sales[SalesAmount]), the value
OPENINGBALANCEYEAR dates[, filter]) Sales[OrderDate]) at the start
of the year
Information Functions:
Checks if a column is in
ISINSCOPE ISINSCOPE(columnName) ISINSCOPE(Products[Category]) the current evaluation
scope
Checks if value is
ISNUMBER ISNUMBER(value) ISNUMBER(123)
numeric
Checks if a subtotal is
ISSUBTOTAL ISSUBTOTAL(columnName) ISSUBTOTAL(Sales[Amount]) being calculated for a
column
Function or Formula Syntax Example Use Cases
Checks if a table
CONTAINS(table, columnName, value, CONTAINS(Products, Products[ID],
CONTAINS …) 101) contains a row with
specified values
Function or
Syntax Example Use Cases
Formula
ISO.CEILING(4.3,
ISO.CEILING ISO.CEILING(number, significance)
1) CEILING but follows ISO rules
ROUNDDOWN(4.567,
ROUNDDOWN ROUNDDOWN(number, num_digits)
2) Always rounds down
Estimates distinct
APPROXIMATEDISTINCTCOUNT APPROXIMATEDISTINCTCOUNT(column) APPROXIMATEDISTINCTCOUNT(Sales[CustomerID]) count faster than
DISTINCTCOUNT
for large datasets
Returns beta
BETA.DIST(x, alpha, beta,
BETA.DIST cumulative, [A], [B])
BETA.DIST(2, 8, 10, TRUE) distribution
probability
Returns inverse
BETA.INV(probability, alpha, of beta
BETA.INV BETA.INV(0.5, 8, 10)
beta, [A], [B]) cumulative
probability
Chi-squared
CHISQ.DIST(x, deg_freedom,
CHISQ.DIST cumulative)
CHISQ.DIST(18.307, 10, TRUE) distribution
probability
Right-tail chi-
CHISQ.DIST.RT CHISQ.DIST.RT(x, deg_freedom) CHISQ.DIST.RT(18.307, 10) squared
distribution
Confidence
CONFIDENCE.NORM(alpha, interval using
CONFIDENCE.NORM CONFIDENCE.NORM(0.05, 1, 50)
standard_dev, size) normal
distribution
Function or Formula Syntax Example Use Cases
Confidence
CONFIDENCE.T(alpha, interval using
CONFIDENCE.T CONFIDENCE.T(0.05, 1, 50)
standard_dev, size) Student's t-
distribution
Population
COVARIANCE.P COVARIANCE.P(columnX, columnY) COVARIANCE.P(Sales[Price], Sales[Quantity])
covariance
Sample
COVARIANCE.S COVARIANCE.S(columnX, columnY) COVARIANCE.S(Sales[Price], Sales[Quantity])
covariance
Sum of squared
DEVSQ DEVSQ(column) DEVSQ(Sales[Amount]) deviations from
mean
Exponential
EXPON.DIST(x, lambda,
EXPON.DIST cumulative)
EXPON.DIST(0.5, 10, TRUE) distribution
probability
Fisher
FISHER FISHER(x) FISHER(0.5)
transformation
Function or Formula Syntax Example Use Cases
Inverse Fisher
FISHERINV FISHERINV(y) FISHERINV(0.5493)
transformation
Returns
confidence
FORECAST.ETS.CONFINT FORECAST.ETS.CONFINT(...) (same style as above)
interval for
forecast
Detects
FORECAST.ETS.SEASONALITY FORECAST.ETS.SEASONALITY(...) (same style) seasonality from
forecast
Returns statistical
FORECAST.ETS.STAT FORECAST.ETS.STAT(...) (same style) info about
forecast
Gamma function
GAMMA GAMMA(x) GAMMA(5)
value
Inverse of
GAMMA.INV(probability, alpha,
GAMMA.INV beta)
GAMMA.INV(0.5, 3, 2) gamma
distribution
Natural log of
GAMMALN GAMMALN(x) GAMMALN(5)
gamma function
Function or Formula Syntax Example Use Cases
Same as above
GAMMALN.PRECISE GAMMALN.PRECISE(x) GAMMALN.PRECISE(5) with higher
precision
Standard normal
cumulative
GAUSS GAUSS(z) GAUSS(2)
distribution from
0 to z
Median of
MEDIANX MEDIANX(table, expression) MEDIANX(Sales, Sales[Amount])
expression values
Most frequent
MODE.SNGL MODE.SNGL(column) MODE.SNGL(Sales[Amount])
value
Normal
NORM.DIST(x, mean, standard_dev,
NORM.DIST cumulative)
NORM.DIST(42, 50, 10, TRUE) distribution
probability
Standard normal
NORM.S.DIST NORM.S.DIST(z, cumulative) NORM.S.DIST(1.333, TRUE)
distribution
Function or Formula Syntax Example Use Cases
Inverse standard
NORM.S.INV NORM.S.INV(probability) NORM.S.INV(0.95) normal
distribution
Exclusive
PERCENTILE.EXC PERCENTILE.EXC(column, k) PERCENTILE.EXC(Sales[Amount], 0.9)
percentile
Inclusive
PERCENTILE.INC PERCENTILE.INC(column, k) PERCENTILE.INC(Sales[Amount], 0.9)
percentile
Exclusive
PERCENTRANK.EXC PERCENTRANK.EXC(column, x) PERCENTRANK.EXC(Sales[Amount], 500)
percentile rank
Inclusive
PERCENTRANK.INC PERCENTRANK.INC(column, x) PERCENTRANK.INC(Sales[Amount], 500)
percentile rank
Poisson
POISSON.DIST(x, mean,
POISSON.DIST cumulative)
POISSON.DIST(2, 5, TRUE) distribution
probability
R-squared
RSQ RSQ(columnY, columnX) RSQ(Sales[Amount], Sales[Quantity])
correlation
Skewness of
SKEW SKEW(column) SKEW(Sales[Amount])
distribution
Function or Formula Syntax Example Use Cases
Population
STDEV.P STDEV.P(column) STDEV.P(Sales[Amount]) standard
deviation
Sample standard
STDEV.S STDEV.S(column) STDEV.S(Sales[Amount])
deviation
Std dev of
STDEVX.P STDEVX.P(table, expression) STDEVX.P(Sales, Sales[Amount]) expression
(population)
Std dev of
STDEVX.S STDEVX.S(table, expression) STDEVX.S(Sales, Sales[Amount]) expression
(sample)
Two-tailed t-
T.DIST.2T T.DIST.2T(x, deg_freedom) T.DIST.2T(1.96, 10)
distribution
Right-tail t-
T.DIST.RT T.DIST.RT(x, deg_freedom) T.DIST.RT(1.96, 10)
distribution
Inverse of t-
T.INV T.INV(probability, deg_freedom) T.INV(0.975, 10)
distribution
Inverse two-
T.INV.2T(probability,
T.INV.2T deg_freedom)
T.INV.2T(0.05, 10) tailed t-
distribution
Population
VAR.P VAR.P(column) VAR.P(Sales[Amount])
variance
Function or Formula Syntax Example Use Cases
Variance of
VARX.P VARX.P(table, expression) VARX.P(Sales, Sales[Amount]) expression
(population)
Variance of
VARX.S VARX.S(table, expression) VARX.S(Sales, Sales[Amount]) expression
(sample)
Table Functions:
Adds
ADDCOLUMNS(table, name, expression, ADDCOLUMNS(Sales, "Profit", Sales[Revenue] calculated
ADDCOLUMNS …) - Sales[Cost]) columns to a
table
Returns
Cartesian
CROSSJOIN CROSSJOIN(table1, table2, …) CROSSJOIN(Products, Customers)
product of
tables
Returns
unique values
DISTINCT DISTINCT(column) DISTINCT(Sales[Region])
from a
column
Returns rows
EXCEPT(DISTINCT(Sales[Region]),
EXCEPT EXCEPT(table1, table2)
DISTINCT(Returns[Region])) in table1 not
in table2
Returns
subset of
FILTER FILTER(table, expression) FILTER(Sales, Sales[Amount] > 1000) table
matching
condition
but includes
rows with no
matches
Returns rows
INTERSECT(DISTINCT(Sales[Region]),
INTERSECT INTERSECT(table1, table2)
DISTINCT(Targets[Region])) common to
both tables
Inner join
using
NATURALINNERJOIN NATURALINNERJOIN(table1, table2) NATURALINNERJOIN(Products, Categories)
common
columns
Left outer
NATURALLEFTOUTERJOIN(table1, join using
NATURALLEFTOUTERJOIN NATURALLEFTOUTERJOIN(Customers, Sales)
table2) common
columns
Creates table
SELECTCOLUMNS(table, name, SELECTCOLUMNS(Sales, "Customer",
SELECTCOLUMNS expression, …) Sales[Customer], "Total", Sales[Amount]) with specific
columns
Groups and
SUMMARIZE(table, groupBy_columnName, SUMMARIZE(Sales, Sales[Region], "Total
SUMMARIZE [name, expression], …) Sales", SUM(Sales[Amount])) summarizes
data
Groups and
SUMMARIZECOLUMNS(groupBy_columnName, SUMMARIZECOLUMNS(Products[Category], summarizes
SUMMARIZECOLUMNS [name, expression], …) "Total", SUM(Sales[Amount])) without row
context
Combines
UNION(DISTINCT(Sales[Region]), rows from
UNION UNION(table1, table2)
DISTINCT(Returns[Region])) multiple
tables
Function or Formula Syntax Example Use Cases
Returns
unique values
VALUES VALUES(column) VALUES(Sales[Region]) from a
column, plus
BLANK if any
Returns top N
TOPN(n_value, table,
TOPN orderBy_expression, [order])
TOPN(5, Sales, Sales[Amount], DESC) rows by sort
order
Groups table
GROUPBY(table, groupBy_columnName, GROUPBY(Sales, Sales[Region], "MaxAmt",
GROUPBY [name, expression], …) MAXX(CURRENTGROUP(), Sales[Amount])) and applies
aggregation
Adds missing
items to a
ADDMISSINGITEMS ADDMISSINGITEMS(table) ADDMISSINGITEMS(VALUES(Products[Category]))
table for
completeness
Parent and Child Functions:
Function or
Syntax Example Use Cases
Formula
Returns a blank
value; often used
BLANK BLANK() IF(SUM(Sales[Amount]) = 0, BLANK())
to hide zeros or
missing data
Stores a value in a
VAR variableName = expression VAR totalSales = SUM(Sales[Amount]) variable for reuse
VAR … RETURN RETURN result RETURN totalSales / 1000 in the same
expression
Returns rows
INTERSECT(VALUES(Sales[CustomerID]),
INTERSECT INTERSECT(table1, table2)
VALUES(Returns[CustomerID])) present in both
tables
Returns rows
EXCEPT(VALUES(Sales[CustomerID]), present in first
EXCEPT EXCEPT(table1, table2)
VALUES(Returns[CustomerID])) table but not in
second
Syntax
Example
Finally, DAX returns sales per quantity using those stored values.
Why Use Variables?
Iterators in DAX
Iterators are DAX functions that loop through a table row-by-row, evaluate an expression for each row, and then aggregate the results.
They are often called the X functions because most of them end with an X (e.g., SUMX , AVERAGEX , RANKX ).
They are more flexible than simple aggregators like SUM or AVERAGE because you can perform a custom calculation on each row before aggregation.
Iterator Functions:
A. Aggregation Iterators
These are the X versions of basic aggregators:
Iterator Syntax Purpose
PRODUCTX PRODUCTX(Table, Expression) Multiplies values of the expression for each row.
B. Counting Iterators
COUNTX COUNTX(Table, Expression) Counts numeric results of the expression per row.
COUNTAX COUNTAX(Table, Expression) Counts all non-blank values from the expression per row.
DISTINCTCOUNTX DISTINCTCOUNTX(Table, Expression) Counts distinct results from the expression per row.
C. Ranking Iterators
RANKX RANKX(Table, Expression, [Value], [Order], [Ties]) Ranks items based on expression result.
FILTER FILTER(Table, Condition) Returns a table of rows meeting a condition (iterates over each row).
ADDCOLUMNS ADDCOLUMNS(Table, Name, Expression, ...) Adds calculated columns after iterating over each row.
SELECTCOLUMNS SELECTCOLUMNS(Table, Name, Expression, ...) Creates a table with new columns after iteration.
GENERATE GENERATE(Table1, Table2) Iterates through each row of Table1 and returns Table2 for each.
CROSSJOIN CROSSJOIN(Table1, Table2) Produces all combinations by iterating through both tables.
DATESBETWEEN DATESBETWEEN(DateColumn, StartDate, EndDate) Iterates over dates between two points.