Forum Discussion

Sudharsanan's avatar
Sudharsanan
Helper III
3 years ago
Solved

Variable Table and measure calculation

Hi All,

 

I have a case where i need to group a set of data and bring the average. 

 

Below is my dataset and i need to group the products to have the sales and qty value and then i need to Avg.

 

ProductSalesQty
AA160.72282.0000
BB81.88641.0000
AA37.74681.0000
AA80.7641.0000
AA80.7641.0000

 

Expected grouping

 

ProductSum of SalesSum of Qty

AA359.99765
BB81.88641

 

Expected Avg value for both : 

ProductSum of SalesSum of QtyAvg
AA359.9976571.99952
BB81.8864181.8864

 

Final Avg for both the products shoudl be as 

76.94296

 

i dont want to create an additional table but wanted to have the above calculations as meaasure.

thanks for you support as always.

5 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    this measure should work for the sum:  

    Measure = CALCULATE(sum('Table'[Sales]),ALLEXCEPT('Table','Table'[Product]))
     
    just create a 2nd one for QTY.
     
    For the average:
     
    Measure 2 = CALCULATE(AVERAGE('Table'[Sales]),ALLEXCEPT('Table','Table'[Product]))
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
      • DOLEARY85's avatar
        DOLEARY85
        Resident Rockstar

        Do you have any more info - can you share what you're seeing?