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

FILTER..

()
Function
in Power BI
01
FILTER () Syntax
The FILTER function is used to filter a table based on
certain condition(s). Let’s explore the intricacies of the
DAX FILTER function.

The FILTER function accepts two arguments -


1. Table
2. Condition

= FILTER(
Table,
Condition
)

youtube.com/@GoodlyChandeep
02

1. The first argument, i.e. Table, accepts a physical or a


virtual table to Filter.

A physical table can be seen in the data model.


A virtual table is one that is created on the fly.

2. The second argument, i.e. Condition accepts a logical


test that is performed in each row of the table.

All rows that satisfy the condition, i.e. return TRUE


are kept while other rows are removed.
Keep in mind the condition must return a TRUE or
FALSE output else it stands invalid.

Remember - The output of the FILTER function is a


table containing the rows that satisfy the condition.

youtube.com/@GoodlyChandeep
03

FILTER Function in a Physical


Table
Let’s apply the FILTER function to the following data,
with the condition that the value in the Sales Amount
column should be $20 or more.

youtube.com/@GoodlyChandeep
04

As the FILTER Function returns a Table, let's create a


Table. Go to Table Tools >>> New Table.

Consider the following DAX code for the table, which


includes a condition that the Sales Amount column
should be greater than or equal to $20.

youtube.com/@GoodlyChandeep
05
In return you’ll get a table with rows that match the
condition.

The FILTER function gives a


table with rows where Sales
Amount >= $20.

youtube.com/@GoodlyChandeep
06
FILTER Function used on a
Virtual Table
The Sales table was a physical table present in the Data
Model, let’s see if we can apply the FILTER function to a
table that doesn’t physically exist i.e. a Virtual Table.

Let’s create a virtual table consisting of all dates where


Total Sales >= $50000. Consider this DAX for creating a
Table.

-- (1)
-- (2)

(1) The VALUES Function creates a one columnar table with


unique Dates.
(2) Then FILTER Functions Checks the condition if the Total
Sales Value for each date is >= $50,000.

youtube.com/@GoodlyChandeep
07

You’ll again get a table with rows that match the


condition.

The output has 133 rows, indicating 133


days of sales over $50,000.

youtube.com/@GoodlyChandeep
I’ve covered a lot more in this
video. You’ve got to watch it.

10:13

DAX FILTER Function


Goodly

youtube.com/@GoodlyChandeep
Jumpstart your learning

DAX & Data Modeling Course

A step by step guide to learn DAX and Data


Modeling to solve real time business problems in
Power BI.

Learn More
Hi, My name is
Chandeep

Checkout my courses on Power BI


Learn More

You might also like