0% found this document useful (0 votes)
114 views

? Dax Functions in Power BI

Uploaded by

whatsappbd001
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)
114 views

? Dax Functions in Power BI

Uploaded by

whatsappbd001
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/ 31

DAX Functions in

Power BI

Examples of 30 Key Functions


SUM Function Example

SUM(SALES[AMOUNT]) THIS WILL SUM THE 'AMOUNT'


COLUMN IN THE 'SALES' TABLE.
AVERAGE(Sales[Amount])
AVERAGE
Function
Example This will return the
average of the 'Amount'
column.
COUNT Function Example

COUNT(Sales[Amount]) This counts the number of non-


blank rows in the 'Amount' column.
DISTINCTCOUNT Function
Example

This counts the number of unique


DISTINCTCOUNT(Sales[ProductID])
products.
CALCULATE Function Example

CALCULATE(SUM(SALES[AMOUNT]), THIS SUMS 'AMOUNT' FOR THE


SALES[REGION] = "EAST") EAST REGION.
FILTER Function Example

FILTER(Sales, Sales[Amount] > 100)

This filters rows where the 'Amount' is greater


than 100.
ALL Function Example

ALL(Sales) This removes any filters applied


on the Sales table.
RELATED RELATED(Product[Price])

Function
Example This brings in 'Price' from
the related 'Product'
table.
SUMX(Sales,

SUMX Sales[Quantity] *
Sales[Price])

Function
This sums after
Example calculating
Quantity * Price.
RANKX(ALL(Sales),
RANKX Sales[Amount])

Function
Example This ranks sales by
'Amount'.
DATEADD(Sales[Date],

DATEADD 1, MONTH)

Function
Example This adds 1 month to
the dates in the 'Date'
column.
DATEDIFF(Sales[StartDate],

DATEDIFF Sales[EndDate], DAY)

Function
Example This calculates the
difference between dates
in days.
SAMEPERIODLAST
YEAR(Sales[Date])

SAMEPERIODLASTYEAR
Function Example

This returns the


same period from
the previous year.
TOTALYTD(SUM(Sal
es[Amount]),
TOTALYTD Sales[Date])

Function
Example This returns the
year-to-date total.
PREVIOUSMONTH(Sales[Date])

PREVIOUSMONTH
Function Example

This returns the previous month.


IF(Sales[Amount] >
IF 100, "High", "Low")

Function
This returns 'High' if
Example the Amount is
greater than 100,
otherwise 'Low'.
SWITCH(TRUE(),
Sales[Amount] > 100,
SWITCH "High", Sales[Amount]
<= 100, "Low")

Function
Example This applies multiple
conditions.
ISBLANK ISBLANK(Sales[Amount])

Function
Example This checks if the
'Amount' column is
blank.
CONCATENATEX(Sales,
Sales[ProductName], ",
")
CONCATENATEX
Function
Example
This concatenates
product names with a
comma.
FORMAT(Sales[Amount],

FORMAT "Currency")

Function
Example This formats the
'Amount' as currency.
DIVIDE(Sales[Amount],
Sales[Quantity], 0)

DIVIDE This safely divides

Function 'Amount' by 'Quantity',


returns 0 if there's an
error.

Example Syntax :
DIVIDE(<numerator>,
<denominator>,
<alternateResult>
MAX MAX(Sales[Amount])

Function
This returns the
Example maximum value in
the 'Amount'
column.
MIN MIN(Sales[Amount])

Function
This returns the
Example minimum value in
the 'Amount'
column.
TOPN(5, Sales,
TOPN Sales[Amount])

Function
This returns the
Example top 5 rows based
on the 'Amount'.
ALLEXCEPT(Sales,
Sales[ProductID])
ALLEXCEPT
Function
Example This removes all
filters except on
'ProductID'.
SELECTEDVALUE SELECTEDVALUE(Sales[Region])
Function
Example This returns the selected value
from the 'Region' column.
HASONEVALUE(Sales[P
roductID])

HASONEVALUE
Function
Example
This checks if only one
value is selected in
'ProductID'.
USERELATIONSHIP(Sal
es[Date],
Calendar[Date])

USERELATIONSHIP
Function Example

This activates a
specific relationship.
CROSSFILTER Function Example

CROSSFILTER(Sales[Region], This changes filter direction


Sales[ProductID], BOTH) between tables.
COALESCE(Sales[Amount],
0)
COALESCE
Function
Example This returns the first non-
blank value, or 0 if none
are found.

You might also like