Top 5 Useful DAX Functions Iiiiin Power BI For Beginners - EPC Group
Top 5 Useful DAX Functions Iiiiin Power BI For Beginners - EPC Group
MENU
MENU
Data Analysis Expression (DAX) in Power BI was practically designed to simplify data
analysis – crunch numbers, visualize patterns and do a lot more. DAX allows users to
customize certain variables and even generate new ones.
Predictive Analytics
Power BI Embedded
Power BI Governance
Power BI Training
5 IMPORTANT DAX FUNCTIONS IN POWER BI FOR BEGINNERS
MENU
1. The FILTER function
The DAX FILTER function allows you to return a subset of an expression or a table.
Here’s a basic DAX expression of the FILTER function:
FILTER(<table>,<filter>)
For example, if you intend to get a count of shipped items from your warehouse based
on the cost of such items, which you define as any item worth over $250, you are
required to use the COUNTROWS function. This function is designed to count the
number of rows in a given table and then you can use the function with the FILTER
function to do this expression:
The first parameter ‘shipped’ indicates a table or an expression that leads to a table.
Also, the second parameter ‘Shipped ‘[Shipped] > 250, indicates a true/false statement
or a Boolean that is assessed for each of the rows in the table.
The above example DAX expression indicates that the Shipped table is being passed to
the FILTER function with a request for it to return shipped items that are over $250.
The FILTER function is not designed to be used or implemented as a standalone
feature. Rather, the FILTER function is used with other functions that can complement
it.
In the DAX formula example above, the FILTER function was used to return a subset
before counting the results of the subset.
For example, if you have a report that contains multiple cards along with a page-level
filter that rules out shipments in a certain country, for instance Canada, you may decide
to retain this filter but include a card visual that indicates the overall number of items
shipped excluding any filter applied on the rest of the entire report.
Below is a DAX expression that indicates how the ALL function can help you perform
the example task above:
In the DAX formula example above, the ‘Shipped’ table was passed to the ALL function
with the request for it to override any filter that has been applied to it before. Similar to
the FILTER function, the ALL function is used along with other function and not as a
standalone feature.
In the example above, the ALL function was used alongside the COUNTROWS function
to get a precise count of all shipped items. The ALL function can work with a column or
a table and it overrides any filter that was applied to them.
3. RELATED
This DAX function is designed to help you return a related value from another table
This DAX function is designed to help you return a related value from another table
aside the one you’re working on. Here’s a basic example of the RELATED expression
below:
RELATED(<column>)
The RELATED function demands that a connection or a relationship exists between the
table you’re working on and the other table with a related data. When you indicate the
column that contains the information that you need, the RELATED function tracks an
existing relation to retrieve the value from the indicated column in the related table.
MENU
When the RELATED function executes a lookup, it evaluates all values in the indicated
table irrespective of any filter that was applied before. The RELATED function is
designed to work in a row context. As a result, it can only be applied in any of the
following situations:
As column expression that has been calculated and where the current row
context is definite.
It can be used in an expression as a nested function that uses a DAX X function.
For example, SUMX.
Using the shipment example mentioned above, let us filter the shipment for another
country – Britain. However, we don’t have all the information we need in one table to
achieve this. But we can use the RELATED function (to extract values from one table to
another based on an existing relationship between both).
Based on the fact that a many-to-one relationship exists between the ‘Shipped’ table
and the ShippedGeography table correspondingly, you can use the RELATED function
to retrieve a count of Shipped items for only Britain. Below is an example of such a DAX
expression:
4. TOTALYTD / TOTALQTD / TOTALMTD
This function performs a similar function like the date and time function in Microsoft
Excel. The Time intelligence functions in DAX allows users to input or change data by
using various periods of time. These include days, months, quarters, and years. This
function also allows users to build and make comparisons between calculations over
such periods of time. MENU
TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
Using the same shipment example mentioned above, if you intend to see the total
number of shipped items to date for this year, you can do so by using the expression
below which uses the TOTALYTD function:
Power BI Consulting
Total shipped items this year = TOTALYTD(SUM(‘Shipped’[Shipped]), ‘Dates’[Dates])
The indicated parameter ‘Shipped’[Shipped], shows the column that you would like to
calculate. It could also be an expression that retrieves a scalar or a singular value. The
other parameter, ‘Date’[Dates], is a column that indicates dates.
Time intelligence functions are very important because they do away with the need for
complex codes in calculating aggregations during one or more periods of time.
5. CALCULATE
The CALCULATE function is one of the most important and multipurpose functions in
DAX Power BI. This function can simplify complex and multiple calculations with simple
efforts. The DAX CALCULATE function assesses an expression in a context that is
changed by specific filters. Below is a basic example of such DAX expressions:
CALCULATE(<expression>, <filter1>,<filter2>…)
Using the same shipment example mentioned above, assuming you are ready to
tabulate all shipments for all the locations your warehouse ships to. Though it is
possible to create some piecemeal expression to tabulate the data, you can also easily
use the CALCULATE function to perform the same task. MENU
Below is an example of how to use the CALCULATE function to perform the above task:
The three restrictions below apply to Boolean expressions that are utilized as
arguments whenever the CALCULATE function is used according to Microsoft:
Nonetheless, a Boolean expression can use any function that evaluates a single value,
or that calculate a scalar value.
Furthermore, if the information you want to calculate has been filtered, the
CALCULATE function will modify the context in which such information was filtered,
and assess the expression in the new context that you indicate. As a result, for each of
the columns utilized in a filter argument, any previous filters on such columns are
eliminated and the filter utilized in the filter argument is used as a replacement. MENU
If you are looking for an experienced Business Intelligence expert proven knowledge
and expertise around Power BI and DAX, please feel free to reach out to schedule a call
and request a quote.
No related posts.
Recent Posts
What Is VoIP PBX & Its Advantages for a Business?
July 16, 2021
Related Posts
Related Posts
No related posts.
Categories
Select Category
MENU
First Name
Last Name
Company
Phone
Title
Submit
EPC Group is an award winning software integration and managed services firm that has been working with
clients to build cloud and digital workplaces, platforms and tools for over 23 years. As a nationally recognized
Microsoft Gold Partner, we are regularly recognized for incorporating cutting edge design and functionality into
all of our customer engagements.
CONNECT WITH US
MENU
SignHouston,
up for blog updates
TX 77056
Email:
Stay up to date [email protected]
SUBSCRIBE NOW