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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
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.