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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Deckard_X42
Frequent Visitor

SUM of Column if selected value is present in another column

Hello Everyone, 

 

I have been fiddeling with this issue for a long time without beeing able to find a solution, maybe you can help me. 

 

Here it is : 

 

I have a fact table with Client, Product and Amount : 

Deckard_X42_0-1634832868831.png

 

Also, I have dimension tables Client and Product that are related to the Fact table : 

Deckard_X42_1-1634833036621.png

 

I want to create a measure that give me the SUM of the "Amount" for every Client that have purchased specific Products. 

 

For instance, if I create a slicer and select the Product 3 : 

 

I want this measure to return the SUM of "Amount" filtered with only Client A and Client C but for all the products. 

 

In this case : Client A (92+3+79+47) + Client C (46+40+79+1). 

 

The issue is also that my Fact table is huge and I query it via DirectQuery and I cannot duplicate it with a SUMMARIZE or a GROUPBY. 

 

Is there a way to do it in the calculation directly? 

 

Idealy, I would like also to select multiple products and have the measure return the SUM for Client that have Product 6 AND/OR Product 3 for instance. 

 

Thank you in advance for your help, 

 

 

 

 

 

1 ACCEPTED SOLUTION

The issue is that the filters will filter the amount by product. 

 

The following measure will produce the desired output : 

 

Total Amount per Client if Product present =

VAR WithProduct =

VALUES( Client[Client] )

RETURN

CALCULATE(

[Total Amount],

REMOVEFILTERS( 'Product'[Product] ),

WithProduct
)

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Have you considered teaching your users how to use filters?

The issue is that the filters will filter the amount by product. 

 

The following measure will produce the desired output : 

 

Total Amount per Client if Product present =

VAR WithProduct =

VALUES( Client[Client] )

RETURN

CALCULATE(

[Total Amount],

REMOVEFILTERS( 'Product'[Product] ),

WithProduct
)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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