USEFUL DATA ANALYSIS EXPRESSIONS (DAX) FUNCTIONS FOR BEGINNERS

USEFUL DATA ANALYSIS EXPRESSIONS (DAX) FUNCTIONS FOR BEGINNERS

DAX (Data Analysis Expression) is a language that PowerPivot uses to create calculations between the columns in the excel data model and also can be used in the Power BI. The difference between the Excel and DAX- Excel works on cell references and ranges of cells whereas DAX works on tables and subsets of tables of data. DAX has many powerful functions which Excel does not have.

DAX Operators

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Sources: docs.microsoft.com/en-us/dax/dax-operator; referencetutorialspoint.com/excel_dax/excel_dax_arithmetic_operators.htm

Using && and || functions for logical test:

No alt text provided for this image

A sample data table with 269,720 rows.

No alt text provided for this image

SUM and SUMX Functions

No alt text provided for this image
No alt text provided for this image

DIVIDE : Performs division and returns alternate result or BLANK() on division by 0.

DIVIDE(<numerator>, <denominator> [,<alternateresult>])

No alt text provided for this image


Logical Function: IF Statement

No alt text provided for this image


DATEDIFF function: Returns the count of interval boundaries crossed between two dates.

DATEDIFF(<start_date>, <end_date>, <interval>)

No alt text provided for this image


CALCULATE Function:

No alt text provided for this image

CALCULATE Function with FILTER :

=CALCULATE(<expression>, <filter1>, <filter2>,…

No alt text provided for this image


SWITCH Function: Evaluates an expression against a list of values and returns one of multiple possible result expressions.

SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])

No alt text provided for this image
No alt text provided for this image

Time Intelligence Functions

Month To date, Quarter to data & Year to date functions

No alt text provided for this image

QTD Transactions: =CALCULATE([Total Transactions],DATESQTD('Calendar-Lookup'[Date]))

YTD Transactions: =CALCULATE([Total Transactions],DATESYTD('Calendar-Lookup'[Date]))

No alt text provided for this image


Rolling Period Total

No alt text provided for this image

10 days Moving Average:

No alt text provided for this image

RELATED Function :returns a related value from another table.

RELATED(<column>)

No alt text provided for this image


RANKX :Returns the ranking of a number in a list of numbers for each row in the table argument.

RANKX(<table>, <expression>[, <value>[, <order>[, <ties>]]])

No alt text provided for this image

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.

No alt text provided for this image





要查看或添加评论,请登录

MANOJ PAUL的更多文章

社区洞察

其他会员也浏览了