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
Anonymous
Not applicable

Average in a table per item

Hi 

 

The avarage cost doesn't work - see beneath:

 

Udklip.PNG

 

The cost is calculated from quantity and line amount.

The avarage cost is calculated as (but it does not work - in the above photo the avarage cost is 343,33 but i'll think it is wrong and it should be 408):

Avarage cost =
AVERAGEX(
'Excel'
;var thisYear = RELATED('Dates'[MonthYear])
return
CALCULATE(
AVERAGE('Excel'[Cost])
;ALLEXCEPT('Excel';'Excel'[Item ID])
;'Dates'[MonthYear] = thisYear))
The difference is calculated as: cost minus avarage cost (but it does not work because of the avarage cost) 
It should be 258,67 in the first line and -388 ind the secound line, and therefore the amount in the table top left should be showing (difference coloum) the total amount in March 2019 = -129,33. 
 
Hope someone can help me quick 🙂 
 
Regards,
Elena
2 REPLIES 2
TeigeGao
Solution Sage
Solution Sage

Hi ElenaJohansen,

According to your description, my understanding is that you want to calculate the average data based on the item id. In this scenario, we can use the following DAX query:

Average cost = CALCULATE(AVERAGE(Excel[Cost]),FILTER(ALLEXCEPT(Excel,Excel[Item ID]),'Dates'[MonthYear] = thisYear))

Best Regards,

Teige

Anonymous
Not applicable

Hi @TeigeGao 

 

I cannot use the DAX query - it tells me following:

Udklip.PNG

Hope you can help me

 

Best regards

Elena Johansen

 

 

 

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.