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
replayyy
Frequent Visitor

Calculate Sum of column based on a column total by client and type of product

Dear All,

 

I am trying to calculate how much revenue is gained through clients which buy a low annual quantity for specific type of products.

 

Enclosed I put 2 tables as a reference. 

 

Steps I am trying to do but doesnt work:

 

Total revenue type good= CALCULATE(SUM(Transaction Table[amount]),FILTER(Transaction Table[type] = "Revenue"), FILTER(Type clients[type] = "Good"))

Total qty sold = CALCULATE(SUM(Transaction Tabel[qty]),FILTER(Type clients[type} = "Good"))
IF(Total qty sold > 5, Total revenue type good,0) 
 
Now I would like to display the amount of revenue generated by "Good" clients while total quantity sold based on item level does not exceed 5 through the year.
 
Can anyone point me into the right direction?
 
Transaction Table
Client nameDatetypeAmountqtyItemcode
A2019Revenue10001Item 1
B2019Revenue2008Item 1
C2019Revenue3008Item 1
D2019Revenue5006Item 1
E2019Revenue8001Item 1
F2019Revenue9002Item 1
A2019Revenue5006Item 2
B2019Revenue664Item 2
C2019Revenue5002Item 2
D2019Revenue3007Item 2
E2019Revenue40010Item 2
F2019Revenue8001Item 2
A2019Revenue5006Item 2
B2019Revenue664Item 2
C2019Revenue5002Item 2
D2019Revenue-3007Item 2
E2019Revenue-400-5Item 2
F2019Revenue8001Item 2
12019Costs-50  
22019Costs-3  
32019Costs-500  
42019Costs-800  
52019Costs-9000  
62019Costs-10000  
72019Costs-5000  
82019Costs-400  

 

Type client

Client nameType
AGood
BGood
CGood
DGood
EBad
FBad
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @replayyy ,

 

 

Try this

 

Measure = SUMX(FILTER(Revenue,RELATED('Client Category'[Type]) = "Good" && Revenue[qty] < 5),Revenue[Amount])

 

1.jpg 

 

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @replayyy ,

 

 

Try this

 

Measure = SUMX(FILTER(Revenue,RELATED('Client Category'[Type]) = "Good" && Revenue[qty] < 5),Revenue[Amount])

 

1.jpg 

 

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@replayyy , use all expect and build this formula at the client level and use

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thnx Amitchandak, I have read the article and I am not sure how to incorporate the allexcept function. Care to elaborate a little?

 

Thank you!

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.