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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JimmyHussein
New Member

Count then multiply

I have 2 tables 1:many 

The sales table which only has the units sold...  so each row counts as a sale...  the sales table doesn't have a quantity column 

 

My product table has the product key which exist in the sales table as well

 

I want to count the number of units per product key and then multiply it by the price of each product key from my product table 

 

Doing the total sales by unit must be done with count as I can't use sum

 

I can get the count but am struggling to get the revenue with the multiply 

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

Try this

 

SUMX(productsTable,productsTable[price] * CALCULATE(COUNTROWS(SalesTable)))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@JimmyHussein , Try like

sumx(summarize(product, "_1",calcuate(sum(sales[quantity])) , "_2",calcuate(sum(product[price]))), [_1]*[_2])

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
wdx223_Daniel
Super User
Super User

=sumx(producttable,producttable[price]*calcuate(sum(salestable[quantity])))

MattAllington
Community Champion
Community Champion

Try this

 

SUMX(productsTable,productsTable[price] * CALCULATE(COUNTROWS(SalesTable)))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.