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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aljazg
New Member

Calculate with filter measure

I have a problem trying to create a measure that would calculate a value based on certain criteria.

 

Model contains four tables:

- products (primary)

- deals (primary)

- sales

- pantheon

 

Relationships:

aljazg_0-1627903199384.png

 

I would like to calculate average of a column in pantheon based on filters from products and then display that measure on dimDeals.

This is my current measure, which is not working:

tp_test = CALCULATE(AVERAGE(Pantheon[ergo_trasferna_cena]),FILTER(ALL(Pantheon),[SM]=1),FILTER(ALL(Products),(Products[Primary_classification]=[primary])),ALL(Products),ALL(Products))

 

So, I want to calculate average of ergo_trasferna_cena for deal id where products primary classification is same to the one of the deal id and SM is 1.

 

I hope I explained it good enough.

 

Here's a screenshot of data that I get (card) and expected data: (table)

 

aljazg_0-1627903917599.png

 

2 REPLIES 2
aljazg
New Member

It returns the same value.

 

SM = MIN(Pantheon[Stage modifier])
primary = CALCULATE(MAX(Products[Primary_classification]),FILTER(Products,Sales[Sales]>0))
 
I show results in a table that contains id from dimDeals, some measures based on Pantheon columns and a measure based on Sales column
Fowmy
Super User
Super User

@aljazg 

Are [sm] and [primary] are measures or columns? Where do you show the results? then what fields are already added there?

Try this one please:

tp_test =
CALCULATE (
    AVERAGE ( Pantheon[ergo_trasferna_cena] ),
    FILTER ( ALL ( Pantheon ), [SM] = 1 ),
    FILTER ( ALL ( Products ), Products[Primary_classification] = [primary] )
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors