Forum Discussion

sw123's avatar
sw123
Helper III
1 year ago
Solved

Help with AVERAGEX

Hi,

 

I am trying to calculate acerage kg per day in Power BI, but can't get it to work. This is the formula I am trying:

 

Average / day = AVERAGEX(VALUES(Dates[Date]), [KG])

 

Where Date comes from my Date table and KG from my Production table. 

 

The error I get is: Column 'KG' cannot be found or may not be used in this expression.

 

Can someone help me calculate average kg / day?

  • Try

    Average / day =
    AVERAGEX ( VALUES ( Dates[Date] ), CALCULATE ( SUM ( Production[KG] ) ) )
    

3 Replies

  • Try

    Average / day =
    AVERAGEX ( VALUES ( Dates[Date] ), CALCULATE ( SUM ( Production[KG] ) ) )
    
    • sw123's avatar
      sw123
      Helper III

      Thank you, this did the trick.

  • Hi sw123 ,

    Make sure that this measure exists [KG], if not, create  a new one by this DAX:

    Total KG = SUM(Production[KG])
    

    And update your Averagex measure to this:

    Average KG per Day = 
    AVERAGEX(
        VALUES(Dates[Date]), 
        [Total KG]
    )