0% found this document useful (0 votes)
265 views8 pages

DAX Functions Cheat Sheet

The document is a comprehensive cheat sheet for DAX functions, categorized into various types such as Aggregation, Date Time, Text, Logical, Math & Trig, and more. Each function is described with its purpose and syntax, providing users with a quick reference for performing calculations and data manipulation in Power BI. It includes functions for statistical analysis, filtering, and time intelligence, among others.

Uploaded by

himakailash1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
265 views8 pages

DAX Functions Cheat Sheet

The document is a comprehensive cheat sheet for DAX functions, categorized into various types such as Aggregation, Date Time, Text, Logical, Math & Trig, and more. Each function is described with its purpose and syntax, providing users with a quick reference for performing calculations and data manipulation in Power BI. It includes functions for statistical analysis, filtering, and time intelligence, among others.

Uploaded by

himakailash1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

DAX Functions Cheat Sheet

Aggregation Summarizes a set of columns into single result.

Function Name Description Syntax


SUM It will return total value of the SUM(numeric column name or
column. decimal column name)
SUMX Return the sum of an expression SUMX(table name, expression)
evaluated for each row in a Note: In place of expression we can
table. pass column name or we can pass
mathematical expression(i.e
Between the columns we can use
any mathematical operator)
AVERAGE It will calculate the average value AVERAGE(numeric column name or
of the column. decimal column name)
AVERAGEX Calculate the average of a set of AVERAGEX(table name, expression)
expressions evaluated over a Note: In place of expression we can
table. pass column name or we can pass
mathematical expression(i.e
Between the columns we can use
any mathematical operator)
MIN Returns the smallest value in a MIN(numeric column name or
column. decimal column name or date
column name)
MINX Evaluates an expression for each MINX(table name, expression,
row of a table and return the [value])
smallest value. Note: In place of expression we can
pass column name or we can pass
mathematical expression(i.e
Between the columns we can use
any mathematical operator)
MAX Returns the largest value in a MAX(numeric column name or
column. decimal column name or date
column name)
MAXX Evaluates an expression for each MAXX(table name, expression,
row of a table and returns the [value])
largest value. Note: In place of expression we can
pass column name or we can pass
mathematical expression(i.e
Between the columns we can use
any mathematical operator)
COUNT Counts the number of rows in COUNT(any column name)
the specified column that
contain non-blank values.
DISTINCTCOUNT Counts the number of distinct DISTINCTCOUNT(any column
values in a column. name)
COUNTROWS The countrows function counts COUNTROWS(any dataset name)
the number of rows in the
specified table.

--Vijay Rama Raju.

Date Time Create calculations based on dates and time.

Function Name Description Syntax


CALENDAR Generate all the dates between CALENDAR(start date, end date)
“Start date” and “End date”. We
can apply on (New Table) option
only.
DATE Returns the specified date in DATE(year, month, day)
“date” format.
DATEDIFF Returns the difference between DATEDIFF(date1, date2, interval)
two dates based on interval.
(Interval as year, month, day)
DAY Returns the day from date DAY(date column name)
column.
MONTH Returns the month number from MONTH(date column name)
date column.
YEAR Returns the year from date YEAR(date column name)
column.
HOUR Returns the hour as a number HOUR(date time column name)
from 0 to 23.
MINUTE Returns the minute as a number MINUTE(date time column name)
from 0 to 59.
SECOND Returns the second as a number SECOND(date time column name)
from 0 to 59.
EOMONTH Based on Interval it always return EOMONTH(datetime column
last date of the month from Date name, interval )
column.
NOW Returns the current date and NOW()
time only.
TODAY Returns the current date with TODAY()
default time.
QUARTER Returns the quarter no based on QUARTER(datetime column name)
date column.
TIME Return the specific time format. TIME(hour, minute, second)

WEEKDAY Returns a number from 1 to 7 WEEKDAY(datetime column name,


identifying the day of the week of return_type )
a date. Return type:
1 week begins on Sunday (1) and
ends on Saturday (7).
2 week begins on Monday (1) and
ends on Sunday (7).
3 week begins on Monday (0) and
ends on Sunday (6).
WEEKNUM Returns the week number for the WEEKNUM(datetime column
given date. name)
NETWORKINGDAYS Returns the number of whole NETWORKDAYS(startdate,
workdays between two dates. enddate, weekend, holidays )
Note: Weekend is Saturday and
Sunday.

Text Function Manipulates and formats text values within table.

Function Name Description Syntax


COMBINEVALUES Combining multiple columns into COMBINEVALUE (delimiter,
single column by using delimiter column name1, column name2,
or special character.(any type of …)
value we can pass)
CONCATENATE We can combine only two CONCATENATE(column name1,
columns in a data set. (Without column name2)
delimiter)
CONCATENATEX Concatenates the result of an CONCATENATEX(table name,
expression evaluated for each column name, delimiter)
row in a table.
EXACT Compares two column values EXACT(any column name1, any
and returns TRUE column name2)
Or FALSE.
FIND Returns the position number FIND(find text, character column
based on specific character .( name, start position, not found
Find is case sensitive) value)
SEARCH Returns the position number SEARCH(find text, character
based on specific character.(It is column name, start position, not
not case sensitive) found value)
FORMAT Converts a value to text according FORMAT(value, format, [locale
to the specified format. name])
1. We can display different date EX:-
formats 1)FORMAT('DateTable'[Date],
2. We can display day, week name, "dd/MM/yyyy")
month no, month name, year, 2) FORMAT('DateTable'[Date],
hour, minute, second etc. "MMM")
3. We can add the currency 3) FORMAT('Value'[Num],"$#.00")
symbol.
LEFT It always returns the number of LEFT(column name, no of
characters from starting position. characters)

RIGHT It always returns the number of RIGHT(column name, no of


characters from starting position. character)

LOWER Each and every character convert LOWER(character column name)


into small letters in character
column.
UPPER Each and every character convert UPPER(character column name)
into capital letters in character
column.
LEN It will calculate the no of characters LEN(any column name)
in a column.

MID It will returns specific position to MID(column name, start position,


no of characters in character no of characters)
column.
REPLACE It will replace from specific position REPLACE(column name, start
to no of characters to new value position, no of characters, new
Use Replace function text)
SUBSTITUTE Replaces existing text with new SUBSTITUTE(column name, old
text in a text string. text, new text, instance number)

TRIM It will remove extra spaces from a TRIM(column name)


text string.
Note: It always remove before
starting of the character and after
end of the character spaces
VALUE Convert a text string that VALUE(column name)
represents a number into a
numeric value.

--Vijay Rama Raju.

Logical Function Performs logical operations.

Function Name Description Syntax

AND (&&) Checks whether both arguments AND(logical1, logical2)


are true, it return true, otherwise it (or)
return false. <expression1> && <expression2>
OR (||) If both arguments are false, it OR(logical1, logical2)
return false, otherwise it return (or)
true. <expression1> || <expression2>
NOT (<>) Changes false to true or true to NOT(logical)
false.
IF Checks a condition if it is true IF(logical test, result if true, [result
returns true statement, otherwise it if false])
returns a false statement.
SWITCH Evaluates an expression against a SWITCH(expression, value1,
list of values and returns one of result1, …, [else])
multiple possible result expressions.
COALESCE Returns the first not blank COALESCE(expression1,
value.(We need to pass more than expression2, …)
one column)
TRUE Returns the logical value true. TRUE()

FALSE Returns the logical value false. FALSE()

Math & Trig Perform Mathematical and trigonometric operation.

Function Name Description Syntax


INT It always display before decimal INT(Decimal Column)
place value without Rounding.

TRUNC It always display specific decimal TRUNC(Decimal Column, no of


place value or before decimal digits)
place value without Rounding.
ROUND Rounds a number to the ROUND(Decimal Column, no of
specified number of digits. digits)

MOD Returns the remainder after a MOD(Numerator column,


number is divided by a divisor. Denominator Column)

CURRENCY Returns the result with currency CURRENCY(Numeric or Decimal


symbol Column)

DIVIDE Performs division and returns DIVIDE(numerator,


alternate result or BLANK() on denominator,[alternatersult])
division by 0.
CONVERT Converts from one data type to CONVERT(expression, datatype)
another.

--Vijay Rama Raju

Other Function Perform unique actions that can’t be defined by any categories.

Function Name Description Syntax

BLANK Returns a blank. BLANK()

Relationship Managing and utilizing relationships between tables.

Function Name Description Syntax

RELATED Getting a column from another RELATED(columnname)


dataset is called Related
USERRELATIONSHIP Using this function we can USERRELATIONSHIP(CommonColu
change inactive to active mn1, CommonColumn2)
relationship between the
datasets.

Statistical Calculate values related to statistical and probability.

Function Name Description Syntax

RANKX It will generate ranks for all the RANKX(table, expression, [value],
rows in the select column. [order], [ties])
Table Manipulation These functions return a table or manipulate tables.

Function Name Description Syntax

UNION To combine rows of multiple UNION(table1, table2, …)


datasets then we can use this
function.
Rules: Column Name and Data
type must and should same in all
the tables
ROW To insert a new row to the ROW(name1, expression1, …)
existing table we have to use row
function.
SUMMARIZE Returns a summary table for the SUMMARIZE(table,
requested totals over a set of [groupby_columnname1], …,
groups. [name1], [expression1], …)
GROUPBY The groupby function is similar to GROUPBY(table,
the summarize function. [groupby_columnname1], …,
[name1], [expression1], …)
ADDCOLUMNS Adds calculated new columns to ADDCOLUMNS(table, name1,
the given table or table expression1, …)
expression.
SELECTCOLUMNS Returns a table with selected SELECTCOLUMNS(table, [name1],
columns from existing table. expression1, ...)

DISTINCT Returns distinct values from the DISTINCT(column name or table


specified column or table expression)
expression.
GENERATESERIES To generate sequential values, GENERATESERIES(startvalue,
we can use this function. endvalue, [incrementvalue])

CROSSJOIN Cartesian product of multiple CROSSJOIN(table1, table2, …)


tables is called CROSSJOIN.

VALUES Returns distinct values from the VALUES(tablename or


specified column or Table. columnname)

--Vijay Rama Raju

Information Check if a value in a cell or row matches the expected type.

Function Name Description Syntax

HASHONEFILTER It will display the value as true HASONFILTER(columnname)


when a value filtered a specified
column in the visualisation.
Otherwise it will return false.
HASHONEVALUE It will display the value as true HASONVALUE(columnname)
when a value filtered a specified
column in the visualisation.
Otherwise it will return false.
ISFILTERED It will display the value as true ISFILTERED(columnname)
when a value filtered a specified
column in the visualisation.
Otherwise it will return false.
ISBLANK It will check whether a column ISBLANK(value)
value is blank, and returns true or
false.
ISEVEN It will check whether the column ISEVEN(number)
value is even or not. If the value is
even then it returns True otherwise
it returns False.
ISODD It will check whether the column ISODD(number)
value is odd or not. If the value is
odd then it returns True otherwise
it returns False.
USERNAME It will return domain name, we are USERNAME()
using this function in row level
security (RLS).
USERPRINCIPALNAM It will return Email id, we are using USERPRINCIPALNAME()
E this function in row level security
(RLS).

Filter Function Modify tables by selecting/excluding rows based on conditions.

Function Name Description Syntax

CALCULATE If you want to calculate the values CALCULATE(expression, [filter1], …)


of aggregate functions based on
expression, then we have to use
calculate function.
FILTER This function will filter there FILTER(table, filterexpression)
records based on the value you
have given in the condition or
based on the value that is selected
by the user in the slicer visual.
SELECTEDVALUE User selected value will be picked SELECTEDVALUE(columnname,
up from the selection and apply [alternateresult])
aggregation function according to
that value and display the measure
value.
ALL This function is useful for clearing ALL([tablename or columnname],
filters and creating calculations on [columnname1], …)
all the rows in a table.
ALLEXCEPT The filters on the columns you have ALLEXCEPT(tablename,
mentioned in the formula and columnname1, ….)
filters will be cleared for all the rest
of the columns in that table.
ALLSELECTED This function will apply the filters ALLSELECTED([tablename or
on selected columns. That means it columnname], [columnname1], …)
will act as default behaviour of
power bi.
LOOKUPVALUE Getting a column from another LOOKUPVALUE(result_column
dataset is called Lookupvalue name, search_columnname1,
search_value1, …,
[alternanate_result])
ROWNUMBER Returns the unique ranking for the ROWNUMBER(relation, orderby,
current context within the blanks, [partitionby], [matchby],
specified partition, sorted by the [reset])
specified order.
RUNNINGSUM Returns a running sum calculated RUNNINGSUM(column, axis, blanks,
along the given axis of the visual [reset])
matrix.

--Vijay Rama Raju


Time Intelligent Manipulates data for comparing calculation over time.

Function Name Description Syntax

DATESBETWEEN This function is used for calculating DATESBETWEEN(dates, startdate,


between start date and end date enddate)

DATESINPERIOD Results will be displayed between DATESINPERIOD(dates, startdate, no


the start date and up to some of intervals, intervals)
period using intervals value.

PARALLELPERIOD Returns parallel period of dates by PARALLELPERIOD(dates, no of


the given set of dates and a intervals, intervals)
specified interval.

ENDOFMONTH It will give the result based on ENDOFMONTH(months)


maximum month and maximum
Year

FIRSTDATE It will give the result based on FIRSTDATE(dates)


minimum date

DATESMTD It will give the result based on DATESMTD(dates)


maximum month and maximum
Year

TOTALMTD It will give the result based on TOTALMTD(expression, dates,


maximum month and maximum [filter])
Year

--Vijay Rama Raju.

You might also like