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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
souvik900766
Helper IV
Helper IV

DAX help--> Calculate the AVG Value of a category on the basis of the AVG of the respective SubCate

Hi!
I want to calculate the AVERAGE Value of a category on the basis of the AVERAGE Value of the respective sub Category.

CategorySub CategoryProductT10/NT10Value
AA1P1T103
AA1P2T104
AA1P3T105
AA2P4T101
AA2P5NT104
AA2P6NT105
AA3P7NT103
AA3P8NT106
BB3P9T101
BB3P10NT104
BB3P11T105
BB3P12NT101
BB1P13T104
BB1P14T106
BB1P15T107

I want the answer to be:-
When I filter T10/NT10 I will get the average of T10/NT10 like:-

T104
NT103.83


When I filter Individual Product I will get the individual value.
When I filter Sub Category, it will be the average of the Product like:-

A14
A23.33
A34.5
B34
B15.6


When I filter Category, it will be the average of the SubCategory within that Category like(A1+A2+A3)/3:

A3.94
B4.8


So when I filter T10 using a slicer I will get 4, I filter Category A then I will Get 3.94, I filter A1 I will get 4 and when I filter P1 I will get 3.
Kindly help me to formulate the DAX.

Thanks in Advance.

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Please try this measure expression, replacing T1 for your actual table name.

 

Avg Value = AVERAGEX(SUMMARIZE(T1, T1[Category], T1[Sub Category]), CALCULATE(AVERAGE(T1[Value])))
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

Please try this measure expression, replacing T1 for your actual table name.

 

Avg Value = AVERAGEX(SUMMARIZE(T1, T1[Category], T1[Sub Category]), CALCULATE(AVERAGE(T1[Value])))
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


littlemojopuppy
Community Champion
Community Champion

@souvik900766 you want the average of averages?  That's an almost meaningless calculation.  Is this only when filtered by Product?  What happens when if you filter by T10/NT10...is that just a simple average?

Ashish_Mathur
Super User
Super User

Hi,

If you filter on A, the answer should be 3.875 (simple average).  I do not understand your logic.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors