DAX

Time Intelligent FunctionsTime intelligence functions support calculations to compare and aggregate data over time periods, supporting days, months, quarters, and years.
FunctionDescription
CLOSINGBALANCEMONTHEvaluates the specified expression for the date corresponding to the end of the current month after applying specified filters.
CLOSINGBALANCEQUARTEREvaluates the specified expression for the date corresponding to the end of the current quarter after applying specified filters.
CLOSINGBALANCEYEAREvaluates the specified expression for the date corresponding to the end of the current year after applying specified filters.
DATEADDMoves the given set of dates by a specified interval.
DATESBETWEENReturns the dates between two given dates.
DATESINPERIODReturns the dates from the given period.
DATESMTDReturns a set of dates in the month up to the last date visible in the filter context.
DATESQTDReturns a set of dates in the quarter up to the last date visible in the filter context.
DATESYTDReturns a set of dates in the year up to the last date visible in the filter context.
ENDOFMONTHReturns the end of month.
ENDOFQUARTERReturns the end of quarter.
ENDOFYEARReturns the end of year.
FIRSTDATEReturns first non blank date.
FIRSTNONBLANKReturns the first value in the column for which the expression has a non blank value.
FIRSTNONBLANKVALUEReturns the first non blank value of the expression that evaluated for the column.
LASTDATEReturns last non blank date.
LASTNONBLANKReturns the last value in the column for which the expression has a non blank value.
LASTNONBLANKVALUEReturns the last non blank value of the expression that evaluated for the column.
NEXTDAYReturns a next day.
NEXTMONTHReturns a next month.
NEXTQUARTERReturns a next quarter.
NEXTYEARReturns a next year.
OPENINGBALANCEMONTHEvaluates the specified expression for the date corresponding to the end of the previous month after applying specified filters.
OPENINGBALANCEQUARTEREvaluates the specified expression for the date corresponding to the end of the previous quarter after applying specified filters.
OPENINGBALANCEYEAREvaluates the specified expression for the date corresponding to the end of the previous year after applying specified filters.
PARALLELPERIODReturns a parallel period of dates by the given set of dates and a specified interval.
PREVIOUSDAYReturns a previous day.
PREVIOUSMONTHReturns a previous month.
PREVIOUSQUARTERReturns a previous quarter.
PREVIOUSYEARReturns a previous year.
SAMEPERIODLASTYEARReturns a set of dates in the current selection from the previous year.
STARTOFMONTHReturns the start of month.
STARTOFQUARTERReturns the start of quarter.
STARTOFYEARReturns the start of year.
TOTALMTDEvaluates the specified expression over the interval which begins on the first of the month and ends with the last date in the specified date column after applying specified filters.
TOTALQTDEvaluates the specified expression over the interval which begins on the first day of the quarter and ends with the last date in the specified date column after applying specified filters.
TOTALYTDEvaluates the specified expression over the interval which begins on the first day of the year and ends with the last date in the specified date column after applying specified filters.
Table Manipulation Functions These functions manipulate and return tables
FunctionDescription
ADDCOLUMNSReturns a table with new columns specified by the DAX expressions.
ADDMISSINGITEMSAdd the rows with empty measure values back.
CROSSJOINReturns a table that is a crossjoin of the specified tables.
CURRENTGROUPAccess to the (sub)table representing current group in GroupBy function. Can be used only inside GroupBy function.
DATATABLEReturns a table with data defined inline.
DETAILROWSReturns the table data corresponding to the DetailRows expression defined on the specified Measure. If a DetailRows expression is not defined then the entire table to which the Measure belongs is returned.
DISTINCTReturns a one column table that contains the distinct (unique) values in a column, for a column argument. Or multiple columns with distinct (unique) combination of values, for a table expression argument.
EXCEPTReturns the rows of left-side table which do not appear in right-side table.
FILTERSReturns a table of the filter values applied directly to the specified column.
GENERATEThe second table expression will be evaluated for each row in the first table. Returns the crossjoin of the first table with these results.
GENERATEALLThe second table expression will be evaluated for each row in the first table. Returns the crossjoin of the first table with these results, including rows for which the second table expression is empty.
GENERATESERIESReturns a table with one column, populated with sequential values from start to end.
GROUPBYCreates a summary the input table grouped by the specified columns.
IGNORETags a measure expression specified in the call to SUMMARIZECOLUMNS function to be ignored when determining the non-blank rows.
INTERSECTReturns the rows of left-side table which appear in right-side table.
NATURALINNERJOINJoins the Left table with right table using the Inner Join semantics.
NATURALLEFTOUTERJOINJoins the Left table with right table using the Left Outer Join semantics.
NONVISUALMark the filter as NonVisual.
ROLLUPIdentifies a subset of columns specified in the call to SUMMARIZE function that should be used to calculate subtotals.
ROLLUPADDISSUBTOTALIdentifies a subset of columns specified in the call to SUMMARIZECOLUMNS function that should be used to calculate groups of subtotals.
ROLLUPGROUPIdentifies a subset of columns specified in the call to SUMMARIZE function that should be used to calculate groups of subtotals.
ROLLUPISSUBTOTALPairs up the rollup groups with the column added by ROLLUPADDISSUBTOTAL.
ROWReturns a single row table with new columns specified by the DAX expressions.
SELECTCOLUMNSReturns a table with selected columns from the table and new columns specified by the DAX expressions.
SUBSTITUTEWITHINDEXReturns a table which represents the semijoin of two tables supplied and for which the common set of columns are replaced by a 0-based index column. The index is based on the rows of the second table sorted by specified order expressions.
SUMMARIZECreates a summary of the input table grouped by the specified columns.
SUMMARIZECOLUMNSCreate a summary table for the requested totals over set of groups.
TOPNReturns a given number of top rows according to a specified expression.
TOPNPERLEVEL
TOPNSKIPRetrieves a number of rows from a table efficiently, skipping a number of rows. Compared to TOPN, the TOPNSKIP function is less flexible, but much faster.
TREATASTreats the columns of the input table as columns from other tables.For each column, filters out any values that are not present in its respective output column.
UNIONReturns the union of the tables whose columns match.
VALUESWhen a column name is given, returns a single column table of unique values. When a table name is given, returns a table with the same columns and all the rows of the table (including duplicates) with the additional blank row if present.
Date and Time FunctionsDate and time functions help creating calculations based on dates and time. Many of the functions in DAX are similar to the Excel date and time functions.
FunctionDescription
CALENDARReturns a table with one column of all dates between StartDate and EndDate.
CALENDARAUTOReturns a table with one column of dates calculated from the model automatically.
DATEReturns the specified date in datetime format.
DATEDIFFReturns the number of units (unit specified in Interval) between the input two dates.
DATEVALUEConverts a date in the form of text to a date in datetime format.
DAYReturns a number from 1 to 31 representing the day of the month.
EDATEReturns the date that is the indicated number of months before or after the start date.
EOMONTHReturns the date in datetime format of the last day of the month before or after a specified number of months.
HOURReturns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
MINUTEReturns a number from 0 to 59 representing the minute.
MONTHReturns a number from 1 (January) to 12 (December) representing the month.
NOWReturns the current date and time in datetime format.
QUARTERReturns a number from 1 (January-March) to 4 (October-December) representing the quarter.
SECONDReturns a number from 0 to 59 representing the second.
TIMEConverts hours, minutes, and seconds given as numbers to a time in datetime format.
TIMEVALUEConverts a time in text format to a time in datetime format.
TODAYReturns the current date in datetime format.
UTCNOWReturns the current date and time in datetime format expressed in Coordinated Universal Time (UTC).
UTCTODAYReturns the current date in datetime format expressed in Coordinated Universal Time (UTC).
WEEKDAYReturns a number identifying the day of the week of a date. The number is in a range 1-7 or 0-6 according to the choice of the ReturnType parameter.
WEEKNUMReturns the week number in the year.
YEARReturns the year of a date as a four digit integer.
YEARFRACReturns the year fraction representing the number of whole days between start_date and end_date.
Text FunctionsText functions manipulate strings
FunctionDescription
COMBINEVALUESCombines the given set of operands using a specified delimiter.
CONCATENATEJoins two text strings into one text string.
CONCATENATEXEvaluates expression for each row on the table, then return the concatenation of those values in a single string result, seperated by the specified delimiter.
EXACTChecks whether two text strings are exactly the same, and returns TRUE or FALSE. EXACT is case-sensitive.
FINDReturns the starting position of one text string within another text string. FIND is case-sensitive and accent-sensitive.
FIXEDRounds a number to the specified number of decimals and returns the result as text with optional commas.
FORMATConverts a value to text in the specified number format.
LEFTReturns the specified number of characters from the start of a text string.
LENReturns the number of characters in a text string.
LOWERConverts all letters in a text string to lowercase.
MIDReturns a string of characters from the middle of a text string, given a starting position and length.
REPLACEReplaces part of a text string with a different text string.
REPTRepeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.
RIGHTReturns the specified number of characters from the end of a text string.
SEARCHReturns the starting position of one text string within another text string. SEARCH is not case-sensitive, but it is accent-sensitive.
SUBSTITUTEReplaces existing text with new text in a text string.
TRIMRemoves all spaces from a text string except for single spaces between words.
UNICHARReturns the Unicode character that is referenced by the given numeric value.
UNICODEReturns the number (code point) corresponding to the first character of the text.
UPPERConverts a text string to all uppercase letters.
VALUEConverts a text string that represents a number to a number.
Financial FunctionsFinancial functions corresponding to Excel functions with the same name.
FunctionDescription
ACCRINTReturns the accrued interest for a security that pays periodic interest.
ACCRINTMReturns the accrued interest for a security that pays interest at maturity.
AMORDEGRCReturns the depreciation for each accounting period. This function is provided for the French accounting system. If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account. The function is similar to AMORLINC, except that a depreciation coefficient is applied in the calculation depending on the life of the assets.
AMORLINCReturns the depreciation for each accounting period. This function is provided for the French accounting system. If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account.
COUPDAYBSReturns the number of days from the beginning of a coupon period until its settlement date.
COUPDAYSReturns the number of days in the coupon period that contains the settlement date.
COUPDAYSNCReturns the number of days from the settlement date to the next coupon date.
COUPNCDReturns the next coupon date after the settlement date.
COUPNUMReturns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.
COUPPCDReturns the previous coupon date before the settlement date.
CUMIPMTReturns the cumulative interest paid on a loan between start_period and end_period.
CUMPRINCReturns the cumulative principal paid on a loan between start_period and end_period.
DBReturns the depreciation of an asset for a specified period using the fixed-declining balance method.
DDBReturns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.
DISCReturns the discount rate for a security.
DOLLARDEConverts a dollar price expressed as an integer part and a fraction part, such as 1.02, into a dollar price expressed as a decimal number. Fractional dollar numbers are sometimes used for securities prices.
DOLLARFRConverts a dollar price expressed as a decimal number into a dollar price expressed as an integer part and a fraction part, such as 1.02. Fractional dollar numbers are sometimes used for securities prices.
DURATIONReturns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of cash flows, and is used as a measure of a bond price's response to changes in yield.
EFFECTReturns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year.
FVCalculates the future value of an investment based on a constant interest rate. You can use FV with either periodic, constant payments, or a single lump sum payment.
INTRATEReturns the interest rate for a fully invested security.
IPMTReturns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
ISPMTCalculates the interest paid (or received) for the specified period of a loan (or investment) with even principal payments.
MDURATIONReturns the modified Macauley duration for a security with an assumed par value of $100.
NOMINALReturns the nominal annual interest rate, given the effective rate and the number of compounding periods per year.
NPERReturns the number of periods for an investment based on periodic, constant payments and a constant interest rate.
ODDFPRICEReturns the price per $100 face value of a security having an odd (short or long) first period.
ODDFYIELDReturns the yield of a security that has an odd (short or long) first period.
ODDLPRICEReturns the price per $100 face value of a security having an odd (short or long) last period.
ODDLYIELDReturns the yield of a security that has an odd (short or long) last period.
PDURATIONReturns the number of periods required by an investment to reach a specified value.
PMTCalculates the payment for a loan based on constant payments and a constant interest rate.
PPMTReturns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
PRICEReturns the price per $100 face value of a security that pays periodic interest.
PRICEDISCReturns the price per $100 face value of a discounted security.
PRICEMATReturns the price per $100 face value of a security that pays interest at maturity.
PVcalculates the present value of a loan or an investment, based on a constant interest rate. You can use PV with either periodic, constant payments (such as a mortgage or other loan), or a future value that's your investment goal.
RATEReturns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns an error.
RECEIVEDReturns the amount received at maturity for a fully invested security.
RRIReturns an equivalent interest rate for the growth of an investment.
SLNReturns the straight-line depreciation of an asset for one period.
SYDReturns the sum-of-years' digits depreciation of an asset for a specified period.
TBILLEQReturns the bond-equivalent yield for a Treasury bill.
TBILLPRICEReturns the price per $100 face value for a Treasury bill.
TBILLYIELDReturns the yield for a Treasury bill.
VDBReturns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify. VDB stands for variable declining balance.
XIRRReturns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
XNPVReturns the net present value for a schedule of cash flows.
YIELDReturns the yield on a security that pays periodic interest. Use YIELD to calculate bond yield.
YIELDDISCReturns the annual yield for a discounted security.
YIELDMATReturns the annual yield of a security that pays interest at maturity.
Information FunctionsInformation functions provide information about data type or filter context of the argument provided.
FunctionDescription
COLUMNSTATISTICSProvides statistics regarding every column in every table in the model.
CONTAINSReturns TRUE if there exists at least one row where all columns have specified values.
CONTAINSROWReturns TRUE if there exists at least one row where all columns have specified values.
CONTAINSSTRINGReturns TRUE if one text string contains another text string. CONTAINSSTRING is not case-sensitive, but it is accent-sensitive.
CONTAINSSTRINGEXACTReturns TRUE if one text string contains another text string. CONTAINSSTRINGEXACT is case-sensitive and accent-sensitive.
CUSTOMDATAReturns the value of the CustomData connection string property if defined; otherwise, BLANK().
HASONEFILTERReturns true when the specified table or column has one and only one value resulting from direct filter(s).
HASONEVALUEReturns true when there's only one value in the specified column.
ISAFTERReturns true if the list of Value1 parameters compares strictly after the list of Value2 parameters.
ISBLANKChecks whether a value is blank, and returns TRUE or FALSE.
ISCROSSFILTEREDReturns true when the specified table or column is crossfiltered.
ISEMPTYReturns true if the specified table or table-expression is Empty.
ISERRORChecks whether a value is an error, and returns TRUE or FALSE.
ISEVENReturns TRUE if number is even, or FALSE if number is odd.
ISFILTEREDReturns true when there are direct filters on the specified column.
ISINSCOPEReturns true when the specified column is the level in a hierarchy of levels.
ISLOGICALChecks whether a value is a logical value (TRUE or FALSE), and returns TRUE or FALSE.
ISNONTEXTChecks whether a value is not text (blank cells are not text), and returns TRUE or FALSE.
ISNUMBERChecks whether a value is a number, and returns TRUE or FALSE.
ISODDReturns TRUE if number is odd, or FALSE if number is even.
ISONORAFTERThe IsOnOrAfter function is a boolean function that emulates the behavior of Start At clause and returns true for a row that meets all the conditions mentioned as parameters in this function.
ISSELECTEDMEASUREReturns true if one of the specified measures is currently being evaluated.
ISSUBTOTALReturns TRUE if the current row contains a subtotal for a specified column and FALSE otherwise.
ISTEXTChecks whether a value is text, and returns TRUE or FALSE.
NAMEOFReturns the name of a column or measure.
SELECTEDMEASUREReturns the measure that is currently being evaluated.
SELECTEDMEASUREFORMATSTRINGReturns format string for the measure that is currently being evaluated.
SELECTEDMEASURENAMEReturns name of the measure that is currently being evaluated.
USERCULTUREReturns the culture code for the user, based on their operating system or browser settings.
USERNAMEReturns the domain name and user name of the current connection with the format of domain-name\user-name.
USEROBJECTIDReturns the current user's Object ID from Azure AD for Azure Analysis Server and the current user's SID for on-premise Analysis Server.
USERPRINCIPALNAMEReturns the user principal name.
Aggregation FunctionsAggregation functions return a scalar value applying an aggregation function to a column or to an expression evaluated by iterating a table expression.
FunctionDescription
APPROXIMATEDISTINCTCOUNTCounts the approximate number of distinct values in a column. Currently this function is only available on a DirectQuery table from Azure SQL or Azure SQL Data Warehouse.
AVERAGEReturns the average (arithmetic mean) of all the numbers in a column.
AVERAGEAReturns the average (arithmetic mean) of the values in a column. Handles text and non-numeric values.
AVERAGEXCalculates the average (arithmetic mean) of a set of expressions evaluated over a table.
COUNTCounts the number of rows in the table where the specified column has a non-blank value.
COUNTACounts the number of values in a column.
COUNTAXCounts the number of values which result from evaluating an expression for each row of a table.
COUNTBLANKCounts the number of blanks in a column.
COUNTROWSCounts the number of rows in a table.
COUNTXCounts the number of values which result from evaluating an expression for each row of a table.
DISTINCTCOUNTCounts the number of distinct values in a column.
DISTINCTCOUNTNOBLANKCounts the number of distinct values in a column.
MAXReturns the largest value in a column, or the larger value between two scalar expressions. Ignores logical values. Strings are compared according to alphabetical order.
MAXAReturns the largest value in a column. Does not ignore logical values and text.
MAXXReturns the largest value that results from evaluating an expression for each row of a table. Strings are compared according to alphabetical order.
MINReturns the smallest value in a column, or the smaller value between two scalar expressions. Ignores logical values. Strings are compared according to alphabetical order.
MINAReturns the smallest value in a column. Does not ignore logical values and text.
MINXReturns the smallest value that results from evaluating an expression for each row of a table. Strings are compared according to alphabetical order.
PRODUCTReturns the product of given column reference.
PRODUCTXReturns the product of an expression values in a table.
SUMAdds all the numbers in a column.
SUMXReturns the sum of an expression evaluated for each row in a table.
Filter FunctionsFilter functions manipulate table and filter contexts.
FunctionDescription
ALLReturns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied.
ALLCROSSFILTEREDClear all filters which are applied to the specified table.
ALLEXCEPTReturns all the rows in a table except for those rows that are affected by the specified column filters.
ALLNOBLANKROWReturns all the rows except blank row in a table, or all the values in a column, ignoring any filters that might have been applied.
ALLSELECTEDReturns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied inside the query, but keeping filters that come from outside.
CALCULATEEvaluates an expression in a context modified by filters.
CALCULATETABLEEvaluates a table expression in a context modified by filters.
FILTERReturns a table that has been filtered.
KEEPFILTERSChanges the CALCULATE and CALCULATETABLE function filtering semantics.
LOOKUPVALUERetrieves a value from a table.
REMOVEFILTERSClear filters from the specified tables or columns.
SELECTEDVALUEReturns the value when there's only one value in the specified column, otherwise returns the alternate result.