0% found this document useful (0 votes)
47 views20 pages

In Power Bi

Uploaded by

Arnab Dey
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)
47 views20 pages

In Power Bi

Uploaded by

Arnab Dey
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/ 20

DAX

IN POWER BI
DAX (DATA ANALYSIS EXPRESSIONS)
It is a formula language and a collection of functions used
to create custom calculations. It helps us create new
information from data already in our model.
Table which I have used to explain DAX functions:

Customer Table

Sales Table

Product Table
Data Model:
Here are some of the important functions:

SUM: Return the sum of the values in a column or an expression.


Syntax: SUM(<column_or_expression>)
CALCULATE: Evaluates an expression in a modified filter context.
Syntax:
CALCULATE(<expression>[, <filter1> [, <filter2> [, …]]])
FILTER: Returns a table that represents a subset of another table
or expression.
Syntax: FILTER(<table>,<filter>)
VALUES: Returns a one-column table that contains the distinct values from the
specified column.
Syntax: VALUES(<TableNameOrColumnName>)
NOTE:
In the earlier slides, we observed that using CALCULATE alone and employing a
combination of CALCULATE, FILTER, and VALUES yield the same result. However,
the latter approach represents a more optimized way of writing DAX.
ALL: Returns all the rows in a table, or all the values in a column, ignoring any filters
that might have been applied.
Syntax:
ALL( [<table> | <column>[, <column>[, <column>[,…]]]] )
ALL SELECTED: This function gets the context that represents all rows and columns in
the query, while keeping explicit filters and contexts other than row
and column filters. .
Syntax:
ALL( [<table> | <column>[, <column>[, <column>[,…]]]] )

Without Adding Explicit Filter After Adding Explicit Filter - Name


ALL EXCEPT: Removes all context filters in the table except filters that have been
applied to the specified columns.
Syntax:
ALLEXCEPT(<table>,<column>[,<column>[,…]])

Without Filter After using Filter - city


COUNTROWS(): This function counts the number of rows in the specified table
Syntax: COUNTROWS([<table>])

COUNT(): Counts the number of rows in the specified column that contain
non-blank values.
Syntax: COUNT([<table>])

COUNTX(): This function is used to count the number of rows in a table that
meet specified conditions.
Syntax: COUNTX([<table>])
SUMMARIZE: This function is used to create a summary table that aggregates data
based on specified groupings or criteria. It's similar to SQL's GROUP BY
clause.
Syntax:
SUMMARIZE (<table>, <groupBy_columnName>
[, <groupBy_columnName>]…[, <name>, <expression>]…)
SELECTEDVALUE(): Returns the value when the context for columnName has been
filtered down to one distinct value only. Otherwise returns
alternateResult.

Syntax:
SELECTEDVALUE(<columnName>[, <alternateResult>])

Showing Defalut value - Paris Showing Selected value - Sydeny


ROW: This function generates a single-row table with specified
column values.
Syntax:
ROW(<name>, <expression>[[,<name>, <expression>]…])
RELATED: Returns a related value from another table.
Syntax:
RELATED(<column>)
RELATEDTABLE: Retrieve a table of related records from a related table based on a
defined relationship between two tables in a data model.
Syntax:
RELATEDTABLE(<tableName>)
DYNAMIC DATE TABLE: Using Calender, Generate and Row
THANK YOU

You might also like