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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
powerlight1
Helper I
Helper I

Apply Filter before Calculating Average

I have the following product-state-date sales data:

 

DateStateProductDamage%SalesCosts
10/01/2026NSWBanana0.110050002985
10/01/2026QLDBanana0.090035002035
10/01/2026VICBanana0.150038002157
10/01/2026NSWApple0.057044003244
10/01/2026QLDApple0.210029801859
10/01/2026VICApple0.049032152470
11/01/2026NSWBanana0.104551902835
11/01/2026QLDBanana0.085536331933
11/01/2026VICBanana0.142539442049
11/01/2026NSWApple0.054245673081
11/01/2026QLDApple0.199530931766
11/01/2026VICApple0.046633372346
12/01/2026NSWBanana0.103548553029
12/01/2026QLDBanana0.084733992065
12/01/2026VICBanana0.141236902189
12/01/2026NSWApple0.053642723292
12/01/2026QLDApple0.197628941886
12/01/2026VICApple0.046131222507

 

I have the PowerBI summarised table for all 3 day's results (note: we just want to summarise by Product-State and not date):

powerlight1_1-1770297025500.png

 

What I want to do is create a filter measure to allow me to filter out those product-state-date where the Damage% is greater than a certain threshold (eg.11%).  I created the following measure:

powerlight1_2-1770297160719.png

I then place "Filter_DamageThreshold" in the Filter section of the above summary table and select value of "1"

powerlight1_3-1770297296294.png

The result is that it is only filtering out the following rows:

powerlight1_6-1770297785380.png

powerlight1_7-1770297899001.png

 

 

 

What I really want to do is to filter out those product-state-date with Damage% greater than or equal to 11% first and then calculate the summary table.  Below rows in yellow is what I want to filter out or exclude from the dataset first:

powerlight1_10-1770298299462.png

 

...and then calculate the summary table therefore giving the following results:

powerlight1_9-1770298265887.png

 

 

 

5 REPLIES 5
v-pnaroju-msft
Community Support
Community Support

Hi powerlight1,

We are following up to see if what we shared solved your issue. If you need more support, please reach out to the Microsoft Fabric community.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Thankyou, @cengizhanarslan, @jgeddes and @Ashish_Mathur for your responses.

Hi powerlight1,

We appreciate your inquiry through the Microsoft Fabric Community Forum.

We would like to inquire whether have you got the chance to check the solutions provided by @cengizhanarslan@jgeddes and @Ashish_Mathur  to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.

Thank you.

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1770338008461.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
jgeddes
Super User
Super User

The solution provided by @cengizhanarslan will work 100%. Another method to solving this is using the 'X' functions. In this case SUMX and AVERAGEX, with a filtered table input. As an example...

Average Damage (Excess damage removed) = 
AVERAGEX(
    FILTER('Table', 'Table'[Damage%] < 0.11),
    'Table'[Damage%]
)

As in the other solution you can create a measure or parameter for the threshold value and reference to it in this measure. I hardcoded it for simplicity.
Cheers.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





cengizhanarslan
Super User
Super User

Your visual-level filter measure is evaluated at the current visual grain (Product-State), not at the underlying Product-State-Date row level, so it won’t exclude date rows first. Use the threshold condition inside each aggregation measure instead:

Threshold % = 0.11
Sales (Filtered) =
VAR T = [Threshold %]
RETURN
CALCULATE(
    SUM('Fact'[Sales]),
    KEEPFILTERS( FILTER('Fact', 'Fact'[Damage%] < T) )
)
Costs (Filtered) =
VAR T = [Threshold %]
RETURN
CALCULATE(
    SUM('Fact'[Costs]),
    KEEPFILTERS( FILTER('Fact', 'Fact'[Damage%] < T) )
)
Damage % (Filtered) =
VAR T = [Threshold %]
RETURN
CALCULATE(
    AVERAGE('Fact'[Damage%]),
    KEEPFILTERS( FILTER('Fact', 'Fact'[Damage%] < T) )
)

 

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.