TOP
# DAX-Lesson 3. FILTER data selection function

## Syntax of the function **FILTER**()

### Related Articles:

DAX-Lesson 2. CALCULATE function

In this article, we will look at another important function, which is called **FILTER** and is used in conjunction with the **CALCULATE function**. The **DAX FILTER function** does the same thing as we do when we try to filter data in a regular table by the values in a certain column. That is, in other words, this function reduces the size of the table with which, in turn, the **CALCULATE function** will work.

=**FILTER(**<*table*>, <*filter*>**)**

**< table>**

The table we want to filter. Also, there can be an expression that returns a table as a result.

**'TableName'****ALL(****'TableName'****)**or**ALL(****'Table Name'**[**Column Name**]**)****FILTER**(**'TableName'**,**'TableName'**[**Column Name**] = "*Green*")**VALUES(****'TableName'**[**ColumnName**])

**< filter>**

A comparison expression that is executed for each row of the table. Conditions for selecting values are specified here.

- [
**ColumnName**] = “*Auto*” - [
**ColumnName**] >=*6*

Let's consider how it looks in practice. Suppose we have a table called **Demo**:

We need to count the number of records for the product ** Bikes** (bicycles) and display the result in a summary table. To do this, write down the following formula:

**=CALCULATE(****COUNTROWS(Demo);FILTER(Demo;Demo[Product]**="*Bikes*"**))**

As a result, we will receive the following values in the field **Count_All_Product**:

What did the **FILTER** function do? She reduced the size of the table, as we do in **Excel**, by setting a filter on the **Product** column and filtering only records with values *Bikes*:

Then counted the number of all rows in the reduced table. We see that there are no entries in the **Count_All_Product** field in the other rows, because the new table does not have skates (*Skates*) and snowboards (*Snow Board*).

- 1. What is VBA, basic concepts.
- 2. Debugger (Debugger)
- 3. Work with sheets (Sheets)
- 4. Working with cells (Ranges)
- 5. Properties (Properties)
- 6.1. Data types (Variables)
- 6.2. Data Types (Continued)
- 7.1. Conditions (Conditions)
- 7.2. Terms (Continued)
- 8.1. Loops (Loops)
- 8.2. Cycles (Continued)
- 9. Procedures and functions
- 10. Dialog windows
- 11.1. Workbook events
- 11.2. Worksheet events
- 12.1. Custom forms
- 12.2. Controls (Controls)
- 12.3. Control elements (Continued)
- 12.4. Control elements (Exercises)
- 13.1. Arrays (Arrays)
- 13.2. Arrays (Continued)
- 13.3. Arrays (Exercises)
- 14.1. Using Excel functions
- 14.2. Creating a custom function

- 1. SQL language, basic concepts.
- 2. Data selection (SELECT)
- 3. Data sorting (ORDER BY)
- 4. Data filtering (WHERE)
- 5. Use of metacharacters (LIKE)
- 6. Calculation (calculation) fields
- 7. Data processing functions
- 8. Data grouping (GROUP BY)
- 9. Sub-requests
- 10. Combination of tables (INNER JOIN)
- 11. OUTER JOIN
- 12. Combined requests (UNION)
- 13. Adding data (INSERT INTO)
- 14. Creating tables (CREATE TABLE)

- Import of currency rates from the NBU website
- Sum written in English
- Unpivottables (Unpivot)
- Function Google Translate
- Camel Case Function
- Snake Case Function
- Kebab Case Function
- Break Case Function
- Sentence Case Function
- Title Case Function
- Fuzzy Lookup Function
- Function GETSUBSTR
- YouLibreCalc extension for LO Calc