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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Sudharsanan
Helper III
Helper III

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.

1 ACCEPTED SOLUTION

Ah okay so the final average needs to be an average of the average measure,

 

try looking at these:

 

https://community.powerbi.com/t5/Desktop/Average-of-measure/td-p/50935

https://community.powerbi.com/t5/Desktop/calculate-average-of-calculated-measure/td-p/568198

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

5 REPLIES 5
DOLEARY85
Super User
Super User

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 👍

Thanks @DOLEARY85 for quick response,

 

but i am not getting the answer as i expected.

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

@DOLEARY85 i am getting a value of 73.65, but i need to get 76.94296

Ah okay so the final average needs to be an average of the average measure,

 

try looking at these:

 

https://community.powerbi.com/t5/Desktop/Average-of-measure/td-p/50935

https://community.powerbi.com/t5/Desktop/calculate-average-of-calculated-measure/td-p/568198

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.