The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 | ||
Inventory | Month | Value |
A | 1 | 2 |
A | 1 | 1 |
A | 1 | 5 |
B | 1 | 5 |
A | 2 | 4 |
A | 2 | 3 |
B | 2 | 8 |
B | 2 | 2 |
B | 2 | 1 |
I would like to the calculate the average value for that month for that inventory like that:
Output | ||
Inventory | Month | Value |
A | 1 | 2.7 |
B | 1 | 5.0 |
A | 2 | 3.5 |
B | 2 | 3.7 |
I tried with divide(sum(Inventory[Value]),COUNTAX(Inventory,Inventory[Month])). Not working!
Can you help me?
Thanks!
Gozde
Solved! Go to Solution.
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?
A is a simple AVERAGE, B is your formula.
Alberto Ferrari
http://www.sqlbi.com
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
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
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?
A is a simple AVERAGE, B is your formula.
Alberto Ferrari
http://www.sqlbi.com
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