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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Microsoft Employee
Microsoft 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
Microsoft Employee
Microsoft 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.