Forum Discussion

JimmyHussein's avatar
JimmyHussein
New Member
5 years ago
Solved

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 

  • Try this

     

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

3 Replies

  • MattAllington's avatar
    MattAllington
    Community Champion

    Try this

     

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

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

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

  • JimmyHussein , Try like

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