Dax Function: ALLCROSSFILTERED

Category: Filter Functions

ALLCROSSFILTERED is a Data Analysis Expressions (DAX) function in Power BI that removes the effects of cross-filtering between two tables in a data model, enabling calculations to disregard relationships and dependencies imposed by those cross-filters.

Purpose

The purpose of the ALLCROSSFILTERED function is to:

  • Clear cross-filters between tables.

  • Ensure that relationships between the specified tables do not influence the calculations.

  • Provide a mechanism for independent analysis of related tables.

Type of Calculations

The function is primarily used in calculations that require:

  • Eliminating cross-filter effects.

  • Returning values as though no cross-filtering exists between the related tables.

Practical Use Cases

  1. Relationship Independence: Analyze a table without being affected by relationships with other tables.

  2. Clearing Relationship Filters: Use in models where bidirectional cross-filtering causes unintended results.

  3. Custom Aggregations: Perform calculations on a table without constraints from cross-filtered data.


ALLCROSSFILTERED(<table>)</table>

ParameterTypeDescription
tableTableThe table for which cross-filters are cleared.

How Does ALLCROSSFILTERED Dax Works

The ALLCROSSFILTERED function works by:

  1. Identifying cross-filters that exist due to relationships between tables.

  2. Removing the cross-filters from the specified table.

  3. Evaluating the calculation as though no cross-filters were applied.

Example Formula:

Independent Sales = CALCULATE( SUM(Sales[Amount]), ALLCROSSFILTERED(Sales) )

Here, ALLCROSSFILTERED(Sales) clears any cross-filters on the Sales table, ensuring that the calculation is independent of relationships.

What Does It Return?

The ALLCROSSFILTERED function returns:

  • Table: An unfiltered version of the input table with all cross-filters removed.

When Should We Use It?

  1. Complex Data Models: When cross-filters create ambiguity or unwanted dependencies.

  2. Unrelated Analysis: To analyze tables without considering their relationships with other tables.

  3. Ensuring Data Integrity: When bidirectional filtering leads to incorrect results.

Examples

Basic Usage :


ALLCROSSFILTERED(Sales)

Removes all cross-filters from the Sales table.

Column Usage


Filtered Regions =
CALCULATE(
DISTINCT(Sales[Region]),
ALLCROSSFILTERED(Sales)
)

Returns distinct regions from the Sales table while ignoring cross-filters.

Advanced Usage


CrossFilter Override =
CALCULATE(
SUM(Sales[Amount]),
ALLCROSSFILTERED(Products)
)

Calculates sales while ignoring cross-filters on the Products table.

Tips and Tricks

  • Use with CALCULATE: This function is best used within the context of CALCULATE to dynamically manage filters.

  • Avoid Overuse: Clearing cross-filters can make certain calculations less meaningful if relationships are critical.

  • Pair with ALL: Use ALL for filter removal and ALLCROSSFILTERED for relationship-based adjustments.

Performance Impact of ALLCROSSFILTERED DAX Function:

  • Be cautious with large datasets, as excessive use of cross-filter removal can lead to slow calculations.

  • Optimize by applying the function only to necessary tables.

Related Functions You Might Need

  • ALL: Removes filters from a table or column.

  • REMOVEFILTERS: Clears filters explicitly for specified columns or tables.

  • CROSSFILTER: Adjusts the cross-filtering direction between tables.

Want to Learn More?
For more information, check out the official Microsoft documentation for ALLCROSSFILTERED You can also experiment with this function in your Power BI reports to explore its capabilities.

Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.

1. What does the ALLCROSSFILTERED function do?

It removes cross-filters from a specified table in Power BI.

2. When should I use ALLCROSSFILTERED in Power BI?

Use it when you need calculations independent of table relationships.

3. How does ALLCROSSFILTERED differ from ALL?

ALL removes filters, while ALLCROSSFILTERED specifically clears cross-filters between related tables.

4. Can ALLCROSSFILTERED affect bidirectional relationships?

Yes, it clears the bidirectional cross-filters applied to the specified table.

5. Is ALLCROSSFILTERED performance-intensive?

It can be, especially in models with extensive relationships or large datasets. Optimize its use.