Forum Discussion

Sandhya877's avatar
Sandhya877
Frequent Visitor
1 year ago
Solved

Row level Totals - Miscalculation

Hi,

I am trying to calculate the total price as shown below. 

 

DAX measure i am using is = sum(quantity) * sum(price) 

 

Instead of caluclating this way : (10 *4) + (20*5) + (30*6)

i am getting total based on this logic: (10+20+30) * (4+5+6)

 

How to create a measure for this logic

(10 *4) + (20*5) + (30*6)

 

I only need to show the entire total. 

 

 

CategoryNameQuantityPriceTotal 
FruitsApple10440 
Fruitsorange205100 
Fruitsbanana306180 
    320Expected Outcome
  6015900This is outcome i am getting in Power BI
  • Hi Sandhya877 

    to force summing the visible values 

    Measure =
    SUMX (
    SUMMARIZE ( 'Table', [Category], [Name] ),
    CALCULATE ( SUM ( [Quantity] ) * SUM ( [Price] ) )
    )

3 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Sandhya877 

    to force summing the visible values 

    Measure =
    SUMX (
    SUMMARIZE ( 'Table', [Category], [Name] ),
    CALCULATE ( SUM ( [Quantity] ) * SUM ( [Price] ) )
    )