CLOSINGBALANCEMONTH
Evaluates the expression at the last date of the month in the current
context.
Syntax
DAX Copy
CLOSINGBALANCEMONTH(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressio
An expression that returns a scalar value.
n
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filter
current context.
Return value
A scalar value that represents the expression evaluated at the last date of
the month in the current context.
Example:
=CLOSINGBALANCEMONTH(SUMX(ProductInventory,ProductInventory[UnitCos
t]*ProductInventory[UnitsBalance]),DateTime [DateKey])
CLOSINGBALANCEQUARTER
Evaluates the expression at the last date of the quarter in the current
context.
Syntax
DAX Copy
CLOSINGBALANCEQUARTER(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressi
An expression that returns a scalar value.
on
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filter
current context.
Return value
A scalar value that represents the expression evaluated at the last date of
the quarter in the current context.
Example:
=CLOSINGBALANCEQUARTER(SUMX(ProductInventory,ProductInventory[
UnitCost]*ProductInventory[UnitsBalance]), DateTime[DateKey])
CLOSINGBALANCEYEAR
Evaluates the expression at the last date of the year in the current context.
Syntax
DAX Copy
CLOSINGBALANCEYEAR(<expression>,<dates>[,<filter>]
[,<year_end_date>])
Parameters
Parameter Definition
expression An expression that returns a scalar value.
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the current
filter
context.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A scalar value that represents the expression evaluated at the last date of
the year in the current context.
Example:
=CLOSINGBALANCEYEAR(SUMX(ProductInventory,ProductInventory[Uni
tCost]*ProductInventory[UnitsBalance]), DateTime[DateKey])
DATEADD
Returns a table that contains a column of dates, shifted either forward or
backward in time by the specified number of intervals from the dates in the
current context.
Syntax
DAX Copy
DATEADD(<dates>,<number_of_intervals>,<interval>)
Parameters
Term Definition
dates A column that contains dates.
number_of_interv An integer that specifies the number of intervals to add to or
als subtract from the dates.
The interval by which to shift the dates. The value for interval can
interval
be one of the following: year, quarter, month, day
Return value
A table containing a single column of date values.
Example:
=DATEADD(DateTime[DateKey],-1,year)
DATESBETWEEN
Returns a table that contains a column of dates that begins with the
start_date and continues until the end_date.
Syntax
DAX Copy
DATESBETWEEN(<dates>,<start_date>,<end_date>)
Parameters
Term Definition
A reference to a date/time
dates
column.
start_da
A date expression.
te
end_dat
A date expression.
e
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
DATESBETWEEN(DateTime[DateKey],
DATE(2007,6,1),
DATE(2007,8,31)
))
DATESINPERIOD
Returns a table that contains a column of dates that begins with the
start_date and continues for the specified number_of_intervals.
Syntax
DAX Copy
DATESINPERIOD(<dates>,<start_date>,<number_of_intervals>,<interv
al>)
Parameters
Term Definition
dates A column that contains dates.
start_date A date expression.
number_of_interv An integer that specifies the number of intervals to add to or
als subtract from the dates.
The interval by which to shift the dates. The value for interval can
interval
be one of the following: year, quarter, month, day
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),DATESINPERIO
D(DateTime[DateKey],DATE(2007,08,24),-21,day))
DATESMTD
Returns a table that contains a column of the dates for the month to date, in
the current context.
Syntax
DAX Copy
DATESMTD(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Property Value/Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
DATESMTD(DateTime[DateKey]))
DATESQTD
Returns a table that contains a column of the dates for the quarter to date, in
the current context.
Syntax
DAX Copy
DATESQTD(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Property Value/Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
DATESQTD(DateTime[DateKey]))
DATESYTD
Returns a table that contains a column of the dates for the year to date, in
the current context.
Syntax
DAX Copy
DATESYTD(<dates> [,<year_end_date>])
Parameters
Term Definition
dates A column that contains dates.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Property Value/Return value
A table containing a single column of date values.
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
DATESYTD(DateTime[DateKey]))
ENDOFMONTH
Returns the last date of the month in the current context for the specified
column of dates.
Syntax
DAX Copy
ENDOFMONTH(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Return value
A table containing a single column and single row with a date value.
Example:
=ENDOFMONTH(DateTime[DateKey])
ENDOFQUARTER
Returns the last date of the quarter in the current context for the specified
column of dates.
Syntax
DAX Copy
ENDOFQUARTER(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Return value
A table containing a single column and single row with a date value.
Example:
=ENDOFQUARTER(DateTime[DateKey])
ENDOFYEAR
Returns the last date of the year in the current context for the specified
column of dates.
Syntax
DAX Copy
ENDOFYEAR(<dates> [,<year_end_date>])
Parameters
Term Definition
dates A column that contains dates.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A table containing a single column and single row with a date value.
Example:
=ENDOFYEAR(DateTime[DateKey],"06/30/2004")
FIRSTDATE
Returns the first date in the current context for the specified column of
dates.
Syntax
DAX Copy
FIRSTDATE(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Return value
A table containing a single column and single row with a date value.
Example:
=FIRSTDATE('InternetSales_USD'[SaleDateKey])
FIRSTNONBLANK
Returns the first value in the column, column, filtered by the current
context, where the expression is not blank.
Syntax
DAX Copy
FIRSTNONBLANK(<column>,<expression>)
Parameters
Term Definition
column A column expression.
expressi An expression evaluated for blanks for each value of
on column.
Property Value/Return value
A table containing a single column and single row with the computed first
value.
Example:
LASTDATE
Returns the last date in the current context for the specified column of dates.
Syntax
DAX Copy
LASTDATE(<dates>)
Parameters
Ter
Definition
m
date A column that contains
s dates.
Return value
A table containing a single column and single row with a date value.
Example:
=LASTDATE('InternetSales_USD'[SaleDateKey])
LASTNONBLANK
Returns the last value in the column, column, filtered by the current
context, where the expression is not blank.
Syntax
DAX Copy
LASTNONBLANK(<column>,<expression>)
Parameters
Term Definition
column A column expression.
expressi An expression evaluated for blanks for each value of
on column.
Property Value/Return value
A table containing a single column and single row with the computed last
value.
Example:
NEXTDAY
Returns a table that contains a column of all dates from the next day, based
on the first date specified in the dates column in the current context.
Syntax
DAX Copy
NEXTDAY(<dates>)
Parameters
Ter
Definition
m
date A column containing
s dates.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
NEXTDAY('DateTime'[DateKey]))
NEXTMONTH
Returns a table that contains a column of all dates from the next month,
based on the first date in the dates column in the current context.
Syntax
DAX Copy
NEXTMONTH(<dates>)
Parameters
Ter
Definition
m
date A column containing
s dates.
Return value
A table containing a single column of date values.
Example :
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
NEXTMONTH('DateTime'[DateKey]))
NEXTQUARTER
Returns a table that contains a column of all dates in the next quarter, based
on the first date specified in the dates column, in the current context.
Syntax
DAX Copy
NEXTQUARTER(<dates>)
Parameters
Ter
Definition
m
date A column containing
s dates.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
NEXTQUARTER('DateTime'[DateKey]))
NEXTYEAR
Returns a table that contains a column of all dates in the next year, based on
the first date in the dates column, in the current context.
Syntax
DAX Copy
NEXTYEAR(<dates>[,<year_end_date>])
Parameters
Term Definition
dates A column containing dates.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
NEXTYEAR('DateTime'[DateKey]))
OPENINGBALANCEMONTH
Evaluates the expression at the first date of the month in the current
context.
Syntax
DAX Copy
OPENINGBALANCEMONTH(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressi
An expression that returns a scalar value.
on
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filter
current context.
Return value
A scalar value that represents the expression evaluated at the first date of
the month in the current context.
Exmaple:
=OPENINGBALANCEMONTH(SUMX(ProductInventory,ProductInventory[U
nitCost]*ProductInventory[UnitsBalance]), DateTime[DateKey])
OPENINGBALANCEQUARTER
Evaluates the expression at the first date of the quarter, in the current
context.
Syntax
DAX Copy
OPENINGBALANCEQUARTER(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressi
An expression that returns a scalar value.
on
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filte*
current context.
Return value
A scalar value that represents the expression evaluated at the first date of
the quarter in the current context.
Example:
=OPENINGBALANCEQUARTER(SUMX(ProductInventory,ProductInventory
[UnitCost]*ProductInventory[UnitsBalance]), DateTime[DateKey])
OPENINGBALANCEYEAR
Evaluates the expression at the first date of the year in the current context.
Syntax
DAX Copy
OPENINGBALANCEYEAR(<expression>,<dates>[,<filter>]
[,<year_end_date>])
Parameters
Parameter Definition
expression An expression that returns a scalar value.
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the current
filter
context.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A scalar value that represents the expression evaluated at the first date of
the year in the current context.
EXAMPLE:
=OPENINGBALANCEYEAR(SUMX(ProductInventory,ProductInventory[Uni
tCost]*ProductInventory[UnitsBalance]), DateTime[DateKey])
PREVIOUSDAY
Returns a table that contains a column of all dates representing the day that
is previous to the first date in the dates column, in the current context.
Syntax
DAX Copy
PREVIOUSDAY(<dates>)
Parameters
Ter
Definition
m
date A column containing
s dates.
Return value
A table containing a single column of date values.
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
PREVIOUSDAY('DateTime'[DateKey]))
PREVIOUSMONTH
Returns a table that contains a column of all dates from the previous month,
based on the first date in the dates column, in the current context.
Syntax
DAX Copy
PREVIOUSMONTH(<dates>)
Parameters
Ter
Definition
m
Date A column containing
s dates.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
PREVIOUSMONTH('DateTime'[DateKey]))
PREVIOUSQUARTER
Returns a table that contains a column of all dates from the previous quarter,
based on the first date in the dates column, in the current context.
Syntax
DAX Copy
PREVIOUSQUARTER(<dates>)
Parameters
Ter
Definition
m
date A column containing
s dates.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
PREVIOUSQUARTER('DateTime'[DateKey]))
PREVIOUSYEAR
Returns a table that contains a column of all dates from the previous year,
given the last date in the dates column, in the current context.
Syntax
DAX Copy
PREVIOUSYEAR(<dates>[,<year_end_date>])
Parameters
Term Definition
dates A column containing dates.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
PREVIOUSYEAR('DateTime'[DateKey]))
PARALLELPERIOD
Returns a table that contains a column of dates that represents a period
parallel to the dates in the specified dates column, in the current context,
with the dates shifted a number of intervals either forward in time or back in
time.
Syntax
DAX Copy
PARALLELPERIOD(<dates>,<number_of_intervals>,<interval>)
Parameters
Term Definition
dates A column that contains dates.
number_of_interv An integer that specifies the number of intervals to add to or
als subtract from the dates.
The interval by which to shift the dates. The value for interval can
interval
be one of the following: year, quarter, month.
Return value
A table containing a single column of date values.
Example:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),
PARALLELPERIOD(DateTime[DateKey],-1,year))
SAMEPERIODLASTYEAR
Returns a table that contains a column of dates shifted one year back in time
from the dates in the specified dates column, in the current context.
Syntax
DAX Copy
SAMEPERIODLASTYEAR(<dates>)
Parameters
Ter
Definition
m
dat A column containing
es dates.
Property Value/Return value
A single-column table of date values.
Example:
=CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]),
SAMEPERIODLASTYEAR(DateTime[DateKey]))
TOTALMTD
Evaluates the value of the expression for the month to date, in the current
context.
Syntax
DAX Copy
TOTALMTD(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressio
An expression that returns a scalar value.
n
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filter
current context.
Return value
A scalar value that represents the expression evaluated for the dates in the
current month-to-date, given the dates in dates.
Example:
=TOTALMTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[Date
Key])
TOTALQTD
Evaluates the value of the expression for the dates in the quarter to date,
in the current context.
Syntax
DAX Copy
TOTALQTD(<expression>,<dates>[,<filter>])
Parameters
Paramet
Definition
er
expressio
An expression that returns a scalar value.
n
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the
filter
current context.
Return value
A scalar value that represents the expression evaluated for all dates in the
current quarter to date, given the dates in dates.
Example:
=TOTALQTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[Date
Key])
TOTALYTD
Evaluates the year-to-date value of the expression in the current context.
Syntax
DAX Copy
TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
Parameters
Parameter Definition
expression An expression that returns a scalar value.
dates A column that contains dates.
(optional) An expression that specifies a filter to apply to the current
filter
context.
year_end_d (optional) A literal string with a date that defines the year-end date.
ate The default is December 31.
Return value
A scalar value that represents the expression evaluated for the current
year-to-date dates.
Example:
=TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[Date
Key])