Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

What are DAX Functions

Data Analysis Expressions (DAX) is a collection of functions and operators essential for Power BI, enabling users to automate data analytics tasks. It includes various categories such as Date and Time Functions, Information Functions, Logical Functions, and Mathematical Functions, each with specific functions like DATE, ISERROR, and SUM. DAX allows users to perform complex calculations and data manipulations efficiently within Power BI.

Uploaded by

yogitas804
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

What are DAX Functions

Data Analysis Expressions (DAX) is a collection of functions and operators essential for Power BI, enabling users to automate data analytics tasks. It includes various categories such as Date and Time Functions, Information Functions, Logical Functions, and Mathematical Functions, each with specific functions like DATE, ISERROR, and SUM. DAX allows users to perform complex calculations and data manipulations efficiently within Power BI.

Uploaded by

yogitas804
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

What are DAX Functions?

Data Analysis Expressions (DAX) is a large and comprehensive


collection of functions and operators that are critical for utilizing many
Power BI features. Using the DAX Functions, you can easily build
expressions that can automate your Data Analytics work.

 DAX Functions for Power BI: Date and Time Functions


 DAX Functions for Power BI: Information Functions
 DAX Functions for Power BI: Logical Functions
 DAX Functions for Power BI: Mathematical & Trigonometric
Functions
 DAX Functions for Power BI: Text Functions
 DAX Functions for Power BI: AggregationFunctions

DAX Functions for Power BI: Date and Time Functions

1. DATE: This function returns a pre-specified date as output in datetime format. It


operates using the following syntax:

DATE(<year>, <month>, <day>)

2. DATEVALUE: This function converts the format of the date from text to datetime.
It operates using the following syntax:

DATEVALUE(date_text)

3. TODAY: This function returns the current date as output and operates using the
following syntax:

TODAY()

4. WEEKDAY: This function takes in date as input and returns a number( 1 to 7)


corresponding to the day of the week of a date. It operates using the following
syntax:

WEEKDAY(<date>, <return_type>)

5. HOUR: This function returns the current hour in the form of a number ( 0 for 12:00
A.M. and 23 for 11:00 P.M.). It operates using the following syntax:

HOUR(<datetime>)

The other important functions under Day and Time Functions are as follows:

 MINUTE
 MONTH
 SECOND

datediff = DATEDIFF(DATE (2001, 07, 01 ),DATE (2002, 12,


31 ),YEAR)

DAX Edate

a date that is the specified number of months before or after the


start date is returned. To determine maturity dates or due dates
that occur on the same day of the month as the date of issue, use
the EDATE function.
edate = EDATE(“28-11-1920”,4)
eomonth = EOMONTH(“21-11-1920”,3)
now=now()
quarter = QUARTER(DATE(1990,02,14))
utcnow = UTCNOW()
weeknum = WEEKNUM(DATE(2007,2,4))
DAX Functions for Power BI: Information Functions

DAX Information functions analyze the input argument and produce


a True or False output. The arguments of this function class are a cell or
row from your Power BI table. The following functions fall under
the Information classification in DAX:

 ISERROR
 ISEVEN
 ISLOGICAL
 ISNUMBER
 ISODD
 ISTEXT
DAX Functions for Power BI: Mathematical & Trigonometric Functions

DAX Mathematical and Trigonometric functions allow you to perform


basic mathematical operations with ease, These functions work similarly to
their Excel counterparts.

1. ABS: This function returns the absolute value of the given input
number using the following syntax:
ABS(<number>)

2. ACOS: This function returns the inverse cosine value of a given


input number. The angle that it returns is in radians ranging from 0
(zero) to pi. It operates using the following syntax:
ACOS(number)

3) CEILING: This function returns the nearest roundup value (integer) of


the given input using the following syntax:

CEILING(<number>, <significance>)

 ASIN
 ATAN
 COS
 DEGREES
 DIVIDE
 EVEN
 EXP
 FACT

convert = CONVERT(DATE(1997,12,23), INTEGER)


currency = CURRENCY(23.44)
degrees = DEGREES(PI())
divide = DIVIDE(234,12)
EVEN (number)
 number: The number you wish to round.

Example: even = EVEN(23.44)


EXP(<number>)
 number: The base e was affected by the exponent. The
natural logarithm’s base, 2.71828182845904, is equal to
the constant.
Example: exp = EXP(4)
fact = FACT(5)
int = INT(55.44)
lcm = LCM(45,56)

DAX LN Math Function

Gives a number’s natural logarithm. Based on the value of the


constant e, natural logarithms (2.71828182845904).
Syntax: LN(<number>)
LOG(<number>, <base>)
log10 = LOG10(1035)
mod = MOD(1035,5)
mround = MROUND(455.6,5)

DAX ODD Math Function

The number is given back, rounded to the nearest odd integer.


Syntax: ODD (number)

Example: odd = ODD(455.6)

DAX Pi Math Function

Gives Pi in decimal form, 3.14159265358979, with a 15-digit


precision.
Syntax: PI()
Example: pi = PI()
quotient = QUOTIENT(234,3)

Syntax: RADIANS (angle)


 angle: An angle that you want to convert from degrees
(Required)
Example: radians = RADIANS(90)
DAX RandBetween Math Function

Gives you a random number that falls between the two values you
provide.
Syntax: RANDBETWEEN(<bottom>, <top>)

DAX Round Math Function

Rounds a value to the specified number of digits.


The number is rounded to the specified number of decimal
places if num digits are higher than zero.
 The number is rounded to the nearest integer if the num
digit is 0.
 The number is rounded to the left of the decimal point if
the num digits are less than 0.
Syntax: ROUND(<number>, <num_digits>)
 number: The value you intend to round.
 num_digits: The number of digits you wish to round to. A
value of zero rounds to the nearest integer; a negative
value rounds digits to the left of the decimal point.
Example: round = ROUND(23.44444,4)

DAX Functions for Power BI: Text Functions

1. BLANK: This function simply returns a blank and works using the
following syntax:
BLANK()

2. CODE: This function returns a numeric value(code) corresponding


to the first character in the input text string. IT operates using the
following syntax:
CODE(text)

3. CONCATENATE: This function joins two input text strings and


returns a single text string using the following syntax:
CONCATENATE(<text1>, <text2>)

4. EXACT: This function compares two text strings and if they are
exactly the same, it returns a true value. It operates using the
following syntax:
EXACT(<text1>,<text2>)

5. FIND: This function returns the starting point of a text string within
another input text string. It operates using the following syntax:
FIND(<find_text>, <within_text>[, [<start_num>][, <NotFoundValue>]])

The other important functions under Text are as follows:

 COMBINEVALUES
 FORMAT
 LEFT
 MID
 REPLACE
 RIGHT
 SEARCH
 SUBSTITUTE
 TRIM

Aggregate Functions
DAX has a number of aggregate functions.

 MIN
 MAX
 Average
 SUM
 SUMX

DAX Logical Functions


IF
A condition is checked, and if it is TRUE, one value is returned;
otherwise, a different value is returned.
Syntax: IF(<logical_test>, <value_if_true>[, <value_if_false>])

AND

The function determines whether both arguments are TRUE and


returns TRUE if they are. If not, returns false.
Syntax: AND(<logical1>,<logical2>)
OR

Returns TRUE if one of the arguments is verified to be TRUE. If both


arguments are false, the function returns FALSE.
Syntax: OR(<logical1>,<logical2>)
SWITCH
Returns one of several potential result expressions after comparing
an expression to a list of values.
Syntax: SWITCH(<expression>, <value>, <result>[, <value>,
<result>]…[, <else>])
Example:

DAX COUNT

COUNT(<column>)
COUNTA(<column>)

DAX CountX

It evaluates an expression over a table and counts the number of


rows that contain a number or an expression that evaluates to a
number. It can be used to calculate the counts of rows based on
certain expressions within FILTER. Two arguments are needed for
the COUNTX function.
COUNTX(<table, expression>)
COUNTX(FILTER(<table, expression>, [column of which counts
needs to be returned]))
Eg.CountX = COUNTX(FILTER('SLS Order Detials_Master', 'SLS
Order Detials_Master'[Unit Price (INR/Unit)] > 1000),
[Product Quanitity]))

DISTINCTCOUNT(<table>)
distinctcount = DISTINCTCOUNT('SLS Order Detials_Product
Master'[Image])

DAX CountBlank

COUNTBLANK(<column>)

DAX CountRows

It determines how many rows there are in the supplied table or a


table that has been defined using an expression.
COUNTROWS([<table>])
Example:
Formula: COUNTROWS('SLS Order Details_Master')

You might also like