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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Gozde
Helper I
Helper I

Calculation for average value of complex data

Hello,

 

I have difficulties to find out the average of the data of multiple inputs/filters in it.

 

My input is look like this: (every month, I got several inputs about different inventories, the number of inputs are not same)

Input
InventoryMonthValue
A12
A11
A15
B15
A24
A23
B28
B22
B21

 

I would like to the calculate the average value for that month for that inventory like that:

 

Output
InventoryMonthValue
A12.7
B15.0
A23.5
B23.7

 

I tried with divide(sum(Inventory[Value]),COUNTAX(Inventory,Inventory[Month])). Not working!

 

Can you help me?

 

Thanks!

Gozde

1 ACCEPTED SOLUTION
AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

Well, then I need to understand the problem... I just copied your data in a sample PBIX and the result looks what you are expecting. Can you show me what is the expected result here?

avg of inventory.png

 

A is a simple AVERAGE, B is your formula.

Alberto Ferrari
http://www.sqlbi.com

 

Alberto Ferrari - SQLBI

View solution in original post

4 REPLIES 4
AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

If you slice by inventory and month, then a simple AVERAGE should solve your issue

A = AVERAGE( Table1[Value] )

Anyway, your code, although more complex, provides the same results... I don't see anything wrong here


Have fun with DAX!

Alberto Ferrari
http://www.sqlbi.com

Alberto Ferrari - SQLBI

Thanks Alberto for the reply,

 

Of course I tried average function in the begining, however it did not work out because I have two filtering that I have to do. these are inventory and month.

 

Also, the number of data points are not same, sum/count is not working!

 

Any more ideas?

 

Regards,

Gozde

AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

Well, then I need to understand the problem... I just copied your data in a sample PBIX and the result looks what you are expecting. Can you show me what is the expected result here?

avg of inventory.png

 

A is a simple AVERAGE, B is your formula.

Alberto Ferrari
http://www.sqlbi.com

 

Alberto Ferrari - SQLBI

You are right, I just simplified my data too much that average is working here, but not my data.

 

I will add my original data in seperate question & closing this one.

 

Thanks for the help!

 

Regards,

Gozde

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors