Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
IuriLinoTi
Regular Visitor

Filtering Slicer vs Chart

Hi all.

I have two tables Prod[Talhao] 1-> * Talhao[Talhao] and i have two measures:

META = SUMX(Talhao,AVERAGE(Talhao[NN3_HECTAR])*25000)
COLHIDO% = SUM(Prod[QUANTIDADE])/[META]
 
This work perfectly when have no one filter, but when i filter in slicer, the measures dont work:
IuriLinoTi_0-1709120395904.png

 

IuriLinoTi_1-1709121286076.png

When filter in chart, the measure also work, but when filter in slicer, dont:

IuriLinoTi_3-1709121377083.png

 

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

It seems like you're encountering a common issue with Power BI when using slicers and filters. When slicers are applied, they filter the data differently from when filters are applied directly to visualizations. This can affect the results of your measures, as you've observed.

To ensure that your measures behave consistently whether you filter using slicers or filter panes directly on visualizations, you can adjust your DAX measures to consider the context correctly.

One approach is to use functions like CALCULATE and FILTER to modify the context within which your measures are evaluated. Here's how you can modify your measures META and COLHIDO%:

 

META =
VAR AvgHectare = AVERAGE(Talhao[NN3_HECTAR]) * 25000
RETURN
CALCULATE(
SUMX(Talhao, AvgHectare),
ALL(Talhao)
)

COLHIDO% =
VAR TotalQuantity = SUM(Prod[QUANTIDADE])
RETURN
DIVIDE(
TotalQuantity,
[META],
0
)

 

In these modified measures:

  • META: We use CALCULATE to override any filters applied by slicers by using the ALL function on the Talhao table. This ensures that the SUMX function operates on all rows of the Talhao table, regardless of any slicer selections.
  • COLHIDO%: We calculate the ratio of TotalQuantity to [META] based on the context established by the slicers.

With these modifications, your measures should behave consistently whether you filter using slicers or directly on charts. Adjustments might be necessary depending on your exact requirements and data model.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

It seems like you're encountering a common issue with Power BI when using slicers and filters. When slicers are applied, they filter the data differently from when filters are applied directly to visualizations. This can affect the results of your measures, as you've observed.

To ensure that your measures behave consistently whether you filter using slicers or filter panes directly on visualizations, you can adjust your DAX measures to consider the context correctly.

One approach is to use functions like CALCULATE and FILTER to modify the context within which your measures are evaluated. Here's how you can modify your measures META and COLHIDO%:

 

META =
VAR AvgHectare = AVERAGE(Talhao[NN3_HECTAR]) * 25000
RETURN
CALCULATE(
SUMX(Talhao, AvgHectare),
ALL(Talhao)
)

COLHIDO% =
VAR TotalQuantity = SUM(Prod[QUANTIDADE])
RETURN
DIVIDE(
TotalQuantity,
[META],
0
)

 

In these modified measures:

  • META: We use CALCULATE to override any filters applied by slicers by using the ALL function on the Talhao table. This ensures that the SUMX function operates on all rows of the Talhao table, regardless of any slicer selections.
  • COLHIDO%: We calculate the ratio of TotalQuantity to [META] based on the context established by the slicers.

With these modifications, your measures should behave consistently whether you filter using slicers or directly on charts. Adjustments might be necessary depending on your exact requirements and data model.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.