Top 5 Useful DAX Functions in Power BI For Beginners - EPC Group

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

 (888) 381-9725 Search...

TOP 5BIUSEFUL
POWER DAX
 DYNAMICS 365 FUNCTIONS FOR
 MICROSOFT TEAMS  AZURERecent
 VIVAPosts
 MICROSOFT SERVICES
BEGINNERS 5 Ways A Microsoft
 Posted by Errin O'Connor
SHAREPOINT  MANAGEDon Oct,
IT21, 2019 11:10
SERVICES  OTHER SERVICES  ABOUT Teams Solution Can Make
Any Business More
Productive
June 24, 2022

Google Data Studio vs


Power BI | Comparison
Guide
June 23, 2022

Understanding Power
Platform Tenant-level
Analytics
Consult Now

June 23, 2022

Power BI & QuickBooks


Online – Operational
By Ryan Alan Dashboard For
QuickBooks Online Data
June 22, 2022

Using Dynamics 365 for


Field Service
Transformation
Framework
June 22, 2022

Related Posts

No related posts.

Sign up for our Email Newsletter


Data Analysis Expression (DAX) in Power BI was
practically designed to simplify data analysis –
Your Name
crunch numbers, visualize patterns and do a lot
more. DAX allows users
Connect With Us
to customize
 SERVICES certain
E-BOOKS RESOURCES Your Email
PODCAST Address
CAREERS BLOG Contact Us
variables and even generate new ones.
SUBSCRIBE NOW
As a beginner, it is absolutely important to
understand exactly how to use or implement
various DAX functions in Power BI which may
seem like a tough task. The entire Power BI EPC Group is an award winning software
integration and managed services firm
dashboard is user-friendly
 (888) 381-9725 and you can learn how Search...
that has been working with clients to build
to do a lot more with it. But first you have to
cloud and digital workplaces, platforms
understand precisely how to use even the most and tools for over 23 years. As a nationally
POWER
basic DAXBI  DYNAMICS
functions in365  MICROSOFT
Power BI. TEAMS  AZURErecognized
 VIVA Microsoft
 MICROSOFT SERVICES
Gold Partner, we
are regularly recognized for incorporating
  OTHER SERVICES cutting edge design and functionality into
 SHAREPOINT  MANAGED IT SERVICES  ABOUT
all of our customer engagements.
Other related topics:

Predictive Analytics
Power BI Embedded
Power BI Governance
Power BI Training

 
Consult Now

5 IMPORTANT DAX FUNCTIONS IN


POWER BI FOR BEGINNERS
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>)
Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

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
(888) of rows in a given table and
381-9725 Search...
then you can use the function with the FILTER
function to do this expression:
 POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA  MICROSOFT SERVICES
Count of shipped items over 250 =
COUNTROWS(FILTER(‘Shipped’,
 SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT
‘Shipped’[Shipped] > 250)) 

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.
Consult Now

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.

2. The ALL Function  


You can use the ALL 
Connect With Us
function to return all of the
SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us
values in a column or all the rows in a specific table
and override any filter that was previously applied.
Below is a basic DAX expression of the ALL
function:

ALL(<table> or <column>)
 (888)if 381-9725 Search...
For example, you have a report that contains
multiple cards along with a page-level filter that
rules
POWERout
BI shipments
 DYNAMICSin a365
certain country,TEAMS
 MICROSOFT for  AZURE  VIVA  MICROSOFT SERVICES
instance Canada, you may decide to retain this
filter but include a card visual that indicates the
 SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT
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:

Count of all shipped items =


COUNTROWS(ALL(‘Shipped’))  

In the DAX formula example above, the ‘Shipped’


Consult Now

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.
  Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

3. RELATED
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
 (888) below:
381-9725 Search...

RELATED(<column>)
 POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA  MICROSOFT SERVICES
The RELATED function demands that a connection
or a relationship exists between the table you’re
SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT
 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.

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
Consult Now

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
Connect With Us
don’t have all the
SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us
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
 (888) 381-9725 Search...
ShippedGeography table correspondingly, you can
use the RELATED function to retrieve a count of
POWER BIitems
Shipped  DYNAMICS
for only 365  MICROSOFT
Britain. TEAMS  AZURE  VIVA  MICROSOFT SERVICES
Below is an
example of such a DAX expression:
 SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT
Count of Shipped items in Britain =
COUNTROWS(FILTER(ALL(‘Shipped),
RELATED(‘ShippedGeography’[Countries] =
“Britain”))

4. TOTALYTD / TOTALQTD /
TOTALMTD
Consult Now

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.

Below is a basic expression of this function:

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:
Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

 (888) 381-9725 Search...

 POWER BI  DYNAMICS
Power BI 365  MICROSOFT TEAMS  AZURE 
Consulting VIVA  MICROSOFT SERVICES

 Total shippeditems
SHAREPOINT this year
MANAGED =
IT SERVICES  OTHER SERVICES  ABOUT
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
Consult Now

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
Connect With Us toSERVICES
tabulate E-BOOKS
the data,RESOURCES
you can PODCAST CAREERS BLOG Contact Us
also easily use the CALCULATE function to
perform the same task.

Below is an example of how to use the


CALCULATE function to perform the above task:

Sum of shipped items all countries =


 (888) 381-9725 Search...
CALCULATE(SUM(‘Shipped’[Shipped]),ALL(‘ShippedGeography’)) 

The indicated parameter,


POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA 
(SUM(‘Shipped’[Shipped]) MICROSOFT SERVICES
shows the column that a
user intends to aggregate. While the other
SHAREPOINTALL(‘ShippedGeography’)),
 parameter,  MANAGED IT SERVICES  OTHER SERVICES
indicates a  ABOUT

Boolean that excludes any filter that have been


applied to the ShippedGeography table.
Consult Now

The three restrictions below apply to Boolean


expressions that are utilized as arguments
whenever the CALCULATE function is used
according to Microsoft:

A measure cannot be referenced by the


expression
A nested CALCULATE function cannot be
used with the expression
Aggregation functions and any function that
scans or returns a table cannot be used with
the expression.

Nonetheless, a Boolean expression can use any


function that evaluates a single value, or that
calculate a scalar value.
Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

 (888) 381-9725 Search...

Furthermore, if the information you want to


POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA 
calculate MICROSOFT SERVICES
has been filtered, the CALCULATE
function will modify the context in which such
SHAREPOINT was
 information  MANAGED
filtered, IT SERVICES
and theOTHER SERVICES  ABOUT
assess
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.

If you are looking for an experienced Business


Intelligence expert with proven knowledge and
expertise around Power BI and DAX, please feel
free to reach out to schedule a call and request a
Consult Now

quote.

Fill In The Form For –


FREE 30 Mins Power BI
Consulting

CALL US TODAY FOR YOUR FREE


CONSULTATION (888) 381-9725

Name Email Company Nam

Contact Numb Your


Message I'm not a robot
reCAPTCHA
Privacy - Terms
Connect With Us 
Submit
SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us

 (888) 381-9725 Search...

 POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA  MICROSOFT SERVICES


Let's Get to Work Together!
Talk to our Microsoft
 SHAREPOINT  MANAGED Gold Certified
IT SERVICES Consultants
OTHER SERVICES  ABOUT
Consult Now
Full Name* Work Email*
Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us
CONTACT
EPC
GROUP
Enter Your Fu Your Official M

Company
Phone Number* Name*

Enter your va Name of your
Call
for
help:
Message*
 (888) 381-9725 Search...
(888)
381- How we can help you...... Type
9725BI  DYNAMICSHere
 POWER 365  MICROSOFT TEAMS  AZURE  VIVA  MICROSOFT SERVICES

 SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT



Email
Us:
I'm not a robot
contact@epcgroup.net reCAPTCHA
Privacy - Terms


Head
Office: SUBMIT
4900
Woodway
Consult Now

Drive -
Suite
830
Houston,
Texas
77056
Connect With Us  SERVICES E-BOOKS RESOURCES PODCAST CAREERS BLOG Contact Us
CONNECT WITH US

  

 
4900 Woodway Dr #830,

Houston,TX(888) 381-9725
77056
Search... Sign up for blog
Email: contact@epcgroup.net
updates
Phone: (888) 381-9725 Stay up to date with all
 POWER BI  DYNAMICS 365  MICROSOFT TEAMS  AZURE  VIVA  MICROSOFT SERVICES
the newest technology
  related blogs from EPC
 SHAREPOINT  MANAGED IT SERVICES  OTHER SERVICES  ABOUT Group

Your Name
EPC Group Provides 24/7 Consulting and Support Services.
Your Email Address

SUBSCRIBE NOW

Copyright © 2022 EPC Group. All rights reserved.


Consult Now

You might also like