Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

3.6 Filter Functions: FILTER, ALL, RELATED

Lesson 27 of 62 in the free Power BI notes on Siksha Sarovar, written by Rohit Jangra.

DAX Filter Functions

Filter functions control which data is evaluated during calculations. They are fundamental to writing powerful and flexible DAX measures.

FILTER()

Returns a table that has been filtered based on a condition. Often used inside other functions like CALCULATE, SUMX, COUNTROWS.

Syntax: FILTER(Table, FilterExpression)

Examples:

High Value Orders = COUNTROWS(FILTER(Sales, Sales[Amount] > 1000))
Electronics Revenue =
SUMX(
    FILTER(Sales, RELATED(Products[Category]) = "Electronics"),
    Sales[Quantity] * Sales[UnitPrice]
)

Key Points: • FILTER returns a table (not a single value) • It iterates row by row (can be slow on large tables) • Best used when you need complex conditions that CALCULATE alone can't handle

ALL()

Removes all filters from a table or column. Returns the entire table/column regardless of any slicers or filters applied.

Syntax:ALL(Table) — removes all filters from a table • ALL(Column) — removes filters from a specific column • ALL(Column1, Column2) — removes filters from multiple columns

Examples:

Percentage of Total:

% of Total Sales =
DIVIDE(
    [Total Sales],
    CALCULATE([Total Sales], ALL(Sales))
)

Grand Total regardless of filters:

Grand Total = CALCULATE([Total Sales], ALL(Products))

ALLEXCEPT()

Removes all filters except from specified columns. Useful when you want to keep some context.

Syntax: ALLEXCEPT(Table, Column1, Column2, ...)

Example:

Category % =
DIVIDE(
    [Total Sales],
    CALCULATE([Total Sales], ALLEXCEPT(Sales, Products[Category]))
)

This calculates the percentage within each category.

RELATED()

Fetches a value from a related table (follows a many-to-one relationship). Works like VLOOKUP in Excel.

Syntax: RELATED(Column)

Example: If Sales table has ProductID and Products table has ProductID + ProductName:

Product Name = RELATED(Products[ProductName])

Key Points: • Works in calculated columns (row context) • Follows the relationship from the "many" side to the "one" side • The relationship must already exist in the data model

RELATEDTABLE()

Returns the entire related table (follows a one-to-many relationship). The opposite direction of RELATED.

Syntax: RELATEDTABLE(Table)

Example — Count of orders per customer:

Order Count = COUNTROWS(RELATEDTABLE(Sales))

(Used as a calculated column in the Customers table)

Comparison Table

FunctionDirectionReturnsUse Case
RELATED()Many → OneSingle valueGet product name from product table
RELATEDTABLE()One → ManyTableCount orders for each customer
FILTER()N/AFiltered tableComplex row-level conditions
ALL()N/AUnfiltered table/columnPercentage of total, grand totals
ALLEXCEPT()N/APartially unfiltered tableKeep specific filter context