Data Analysis Expressions (DAX) is a formula expression language used in Analysis Services, Power BI, and Power Pivot in Excel. It is a programming language that is used throughout Microsoft Power BI for constructing calculated columns, measures, and custom tables. It is a compilation of functions, operators, and constants that can be utilized in a formula, or expression, to calculate and return one or more values.
You can easily alter your data model by using DAX to solve a number of calculations and analysis problems.
DAX in Power BI:
DAX formulas are very handy in BI tools like Power BI as they help data analysts to use the data sets, they have to the deepest potential.
With the help of the DAX language, analysts can discover different ways to calculate data values they have and come up with creative insights. It is really very easy to generate smooth reports in Power BI with just few knowledge of BI software and by using functionalities of Data importing, functionalities and visualization.
There are number of changes takes place in year 2022. Various new functions were added in the list of DAX functions. Here is a list of few that were added in 2022:
- NETWORKDAYS
- TOJSON
- TOCSV
- EVALUATEANDLOG
- WINDOW
- PARTITIONBY
- ORDERBY
- OFFSET
- INDEX
Let’s talk in brief about these functions:
NETWORKDAYS:
Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.
Syntax:
NETWORKDAYS ( <start_date>, <end_date> [, <weekend>] [, <holidays>]
TOJSON
Converts the records of a table into a JSON text.
Syntax:
TOJSON(, [MaxRows])
TOOCSV
Returns a table as a string in CSV format. It converts the records of a table into a CSV (comma-separated values) text.
Syntax:
TOCSV(, [MaxRows], [Delimiter], [IncludeHeaders])
EVALUATEANDLOG
Return the value of the first argument and also log the value in DAX evaluation log. This function is fully functional in Power BI Desktop only. It acts as a simple passthrough function in other environments.
Syntax:
EVALUATEANDLOG(<Value>, [Label], [MaxRows])
WINDOW
Retrieves a range of rows within the specified partition, sorted by the specified order or on the axis specified.
Syntax:
WINDOW ( from[, from_type], to[, to_type][, <relation>][, <orderBy>][, <blanks>][, <partitionBy>] )
PARTITIONBY
The columns used to determine how to partition the data. Can only be used within a Window function. It defines the columns that are used to partition a window function’s parameter.
Syntax:
PARTITIONBY ( <partitionBy_columnName>[, partitionBy_columnName [, …] ] )
ORDERBY
The columns and order directions used to determine the sort order within each partition. Can only be used within a Window function.
Syntax:
ORDERBY ( <orderBy_columnName>[, <order>][, orderBy_columnName [, <order>]] [, …] )
OFFSET
Retrieves a single row from a relation by moving a number of rows within the specified partition, sorted by the specified order or on the axis specified.
Syntax:
OFFSET ( <delta>[, <relation>][, <orderBy>][, <blanks>][, <partitionBy>] )
Returns a row at an absolute position, specified by the position parameter, within the specified partition, sorted by the specified order. If the current partition can’t be deduced to a single partition, multiple rows may be returned. It Retrieves a row at an absolute position (specified by the position parameter) within the specified partition sorted by the specified order or on the axis specified.
Syntax:
INDEX(<position>[, <relation>][, <orderBy>][, <blanks>][, <partitionBy>])
Sum Up:
To sumup this blog Power BI file is attached for your quick reference. Where you can easily explore all the defined functions!!
Hope you Enjoy!! And Happy learning!!!
Be the first to comment