close

Bi-Directional Cross Filter in Power BI

Posted by Errin O'Connor on Feb, 15, 2022 08:02

Bi-Directional Cross Filter in Power BI - thumb image

The CROSSFILTER function determines the direction of cross-filtering to be utilized in a calculation for a two-column relationship.

This function leverages existing relationships in the model to specify the cross-filtering direction for the indicated relationship, distinguishing relationships by their ending point columns. When necessary, this filter is applied through the relationships in the many-to-one manner, which is a highly effective and sensible technique.

What does Cross Filter Direction mean in Power BI?

In comparison to other database management systems, Power BI’s relationships are a little different. The majority of systems only have a relationship and there is no particular Direction for it. Nevertheless in Power BI the relationship has a direction. Cross filter direction in Power BI has a big impact on how filtering works.

What is Bidirectional Cross Filtering in Power BI?

Report writers and data modelers now have more control over how they apply filters while dealing with related tables, owing to bidirectional cross-filtering. They can apply filters on both sides of a table relationship using bidirectional cross-filtering. By spreading the filter context to a second related table on the other side of a table relationship, developers can apply the filters.

Benefits of Bidirectional Cross Filtering

The bidirectional cross-filtering tool in Power BI is popular among creators. It surely comes with a slew of advantages.

  • You get computations from both sides of a table relationship when you apply filters to both sides. This, of course, means you’ll have more responses, which means you won’t miss out on crucial information that could lead to significant business decisions. Left-to-right linkages aren’t always enough to satisfy a modeler’s needs. It’s sometimes necessary to examine how a relationship functions in the opposite direction. You can cover more of your data needs with bidirectional cross-filtering.
  • You can develop and deliver more detailed reports as a result of the additional information you’ll acquire from bidirectional cross-filtering. This way, you’re not the only one who gains from the additional knowledge. Your end-users will also be able to avoid losing out on key information, resulting in superior overall insights. Finally, more granular data can help you make better overall decisions for certain divisions or your entire company.
  • You also don’t have to conduct the difficult math yourself because the bidirectional cross-filtering capability is already incorporated into the Power BI solution. You also won’t have to employ complicated DAX formulas, which are useful but time-consuming in these circumstances. You can just use the relevant filters right away.

Ultimately, the benefits of bidirectional cross-filtering are as diverse as the modelers who use them. The more you familiarize yourself with your options, the more confident you’ll be when you apply them to your reports.

Challenges of Bidirectional Cross Filtering

The most difficult challenge of bidirectional cross-filtering is how it affects the overall performance of Power BI. The option puts the application under a little more pressure than single-direction filtering. As a consequence, excessive bidirectional cross-filtering can cause Power BI to slow down.

Users can use it as needed, but they should try and avoid making it their default. This way, the performance would be much more efficient and hassle-free. 

The existing filtering options in Power BI are intended to be balanced. All the options that a user needs are right there, but the default settings ensure that Power BI runs well.

How to Enable bidirectional cross-filtering for DirectQuery?

Cross-filtering can be enabled from the edit relationship dialog box. The following settings must be configured to enable cross-filtering for a relationship:

Go to Manage Relationship menu under Modeling tab as below – 

Manage Relationship Option

Then Select Edit under Manage relationship dialog box as shown below – 

edit relationship option

Set the direction of the cross filter to both. Choose both orientations to apply the security filter – 

Bidirectional Filter in Power BI

What is the default visual interaction in Power BI?

Drill Mode On should be the default visual interaction in Power BI; you can turn it off, but if you leave it off, you will have to alter it every time. Set the Default to ‘Drill Mode On‘ instead.

Drill Mode indicates that if the totals are at the yearly level, then this mode can allow the user to drill down to monthly, weekly, daily, and so on. Drilling down to a certain level is only feasible because of the data.

How to change default visual settings in Power BI?

Step 1: Choose a visualization to activate it.

Step 2: Display the visual interaction options.

Select the dropdown from the report menu bar in the Power BI service.

Select Format > Interactions from the Desktop menu.

Then choose edit interactions. All of the other visualizations on the report page get cross-filtered and cross-highlighted icons from Power BI.

Drilling Filters and other visualizations can now be selected. When you drill down or roll up in a visualization (Drill down and up), the modifications will now match the current drilling selection.

Types of interactions in Power BI

Drill down, roll up, filter, highlight, and no impact are the options.

CROSS-FILTER function in Power BI –  

Example: Let’s say there is a report which lists out the products a company sells and where they were sold. For each sale, they have the shopping center where it occurred. Obviously, a single product can have been sold in many different centers. For each product, they would like to know how many centers it is being sold in:

Use of Cross-filtering – 

Step One: Set the Cross-filter direction to both, it will allow the Purchase table to filter the Centre table.  This should make the count of centers for each product correct.

Step Two: Create two slicers, one containing the Product Names and one containing the Centre Names. 

What happens when you try filtering the table using the Product Name slicer?

Some of the Centre Names will vanish.

Using a DAX measure to change cross-filtering temporarily

In the relationship view switch the filtering back to single – 

  1. Filtering by center should change which products you see but changing the products shouldn’t impact the centers displayed: i.e., the relationship should be one-way only. This can be done by creating a measure that mimics the effects of this change:
  2. You can use the CALCULATE function to change the filter context for a calculation (such as the relationship between two tables).
  3. CROSSFILTER takes in the columns from each table used to join the tables together and lets the users indicate the direction of filtering allowed.
  4. The measure will show the number of stores for each product as if both relationships existed, while the count shows the relationship doesn’t exist. All center names will be shown now.

Control Cross Filtering of Charts in Power BI

Create a Power BI report with at least two chart objects first. Then take the following steps:

  1. Select the new Edit button under “Visual Interactions” from the drop-down menu.
  2. Pick one of the graphs.
  3. A set of three icons will appear next to all other charts on the page.
  4. If you pick the pie chart icon, the original chart will be visually filtered using shading to show the new share – this was the default behavior.
  5. When you click the filter button, the entire chart is refreshed for the subset of data you selected.

The chart will not filter if you select the Ghostbusters emblem. After you’ve chosen the desired behavior, click the Edit button again, and the icons will vanish.

Every single chart on your canvas can have its cross-filter behavior adjusted precisely how you want it for cross-filtering from other charts — complete granular control.

Optimizing cross-filtering performance using aggregate awareness

The filtering options for single-direction filtering operate on the table where we’re aggregating values. There could be more than one route for fields to pass across tables with bi-directional filtering. When generating visualizations that use fields from different tables, this ambiguity can mislead Power BI and lead to problems.

However, with a star schema model like this, bi-directional filtering is entirely safe for our relationships. Determining the proper table associations can have an impact on how your data model functions. Aggregate awareness allows data teams to restrict the amount of data queried while also avoiding the hazards of data extraction, which can be quite uncomfortable for analytic teams.

Cross filtering in Power BI: Recommended or not?

When you execute cross-filtering, there is always a performance hit, so users should only do it when it is really necessary. Cross-filtering is believed to be one of the top Power BI performance killers since Power BI has to really work hard with it.

Conclusion

Finally, Cross Filter is a useful function for shifting the direction of a relationship. Instead of changing the relationship’s direction, this method can be adopted. However, before you begin, consider power bi modeling cross filter direction best practices.

Frequently Asked Questions – 

1.How do visuals cross filter each other in a Power BI report?

 – Choosing a data point in one visual on a report page will automatically cross-filter or highlight the other visuals on the page. The report designer determines how the visuals on a page interact. Designers may toggle visual interactions on and off, as well as adjust the default behavior for cross-filtering, and drilling.

2.How do you link two filters in Power bi?

– To connect to the data source and import it into your model, you’ll need to utilize Excel or Power BI Desktop. You can either construct a calculated column or measure as part of your Excel or Power BI Desktop data model, or you can build a calculated column or measure as part of the query using “M” code.

CALCULATE is defined as CALCULATE (<expression>, <filter1>,<filter2>…). This implies you can apply many filters simultaneously. Multiple filters, on the other hand, will act in coordination. In other words, the data would have to satisfy both requirements.

Contact Us

  • break

Call For Your Free Consultation
1.866.667.1368